Class: Mutations::Auth::ResetPassword
- Inherits:
-
GraphQL::Schema::Mutation
- Object
- GraphQL::Schema::Mutation
- Mutations::Auth::ResetPassword
- Defined in:
- app/graphql/mutations/auth/reset_password.rb
Instance Method Summary collapse
Instance Method Details
#resolve(args) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/graphql/mutations/auth/reset_password.rb', line 19 def resolve(args) user = User.where(locked_at: nil).reset_password_by_token args if user.errors.any? { success: false, errors: user.errors..map do |field, | field = field == :reset_password_token ? :_error : field.to_s.camelize(:lower) { field: field, message: .first.capitalize } end } else { errors: [], success: true } end end |