Class: Mutations::Auth::UnlockAccount
- Inherits:
-
GraphQL::Schema::Mutation
- Object
- GraphQL::Schema::Mutation
- Mutations::Auth::UnlockAccount
- Defined in:
- app/graphql/mutations/auth/unlock_account.rb
Instance Method Summary collapse
Instance Method Details
#resolve(id:) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/graphql/mutations/auth/unlock_account.rb', line 12 def resolve(id:) user = User.where.not(locked_at: nil).find_by id: id if context[:current_user] && user.present? && user.unlock_access! { errors: [], success: true, user: user } else { errors: [ { field: :_error, message: I18n.t('devise.unlocks.cannot_unlock') } ], success: false, user: user } end end |