verify.rb 735 B

123456789101112131415161718192021222324252627
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Mutations
  3. class User::PasswordReset::Verify < BaseMutation
  4. description 'Verify password reset token.'
  5. argument :token, String, required: true, description: 'Verification token'
  6. field :success, Boolean, description: 'This indicates if the password reset token is valid.'
  7. def self.authorize(...)
  8. true
  9. end
  10. def resolve(token:)
  11. verify = Service::User::PasswordReset::Verify.new(token: token)
  12. begin
  13. verify.execute
  14. rescue Service::User::PasswordReset::Verify::InvalidTokenError => e
  15. return error_response({ message: e.message })
  16. end
  17. { success: true }
  18. end
  19. end
  20. end