Class: Mutations::Authentication::ForgotPassword

Inherits:
GraphQL::Schema::Mutation
  • Object
show all
Includes:
Graphql::AccountLockHelper
Defined in:
app/graphql/mutations/authentication/forgot_password.rb

Instance Method Summary collapse

Methods included from Graphql::AccountLockHelper

#account_locked?, #lockable?

Instance Method Details

#resolve(email:) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/graphql/mutations/authentication/forgot_password.rb', line 14

def resolve(email:)
  if lockable?
    user = User.where(locked_at: nil).find_by email: email
  else
    user = User.find_by email: email
  end

  user.send_reset_password_instructions if user.present?

  {
    errors: [],
    success: true,
    valid: true
  }
end