Class: WithAccounts::LoginInvitationsCreating::FindAndCheckAccount

Inherits:
LetsDoThis::Act
  • Object
show all
Includes:
ErrorsHelpers
Defined in:
app/scenarios/with_accounts/login_invitations_creating/find_and_check_account.rb

Instance Method Summary collapse

Methods included from ErrorsHelpers

#error_key, #format_errors

Instance Method Details

#instructions(stage) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/scenarios/with_accounts/login_invitations_creating/find_and_check_account.rb', line 6

def instructions(stage)
   = Account.(:_)
                   .joins(:user)
                   .where('users.disabled': false, 'users.email': stage.email)
                   .take&.authenticate(stage.password)

  unless 
    errors.add(error_key, 'err')
    return NOTHING_NEW
  end

  { account:  }
end