verify.rb 533 B

1234567891011121314151617181920212223242526
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Service::User::PasswordReset::Verify < Service::Base
  3. attr_reader :token
  4. def initialize(token:)
  5. super()
  6. @token = token
  7. end
  8. def execute
  9. Service::CheckFeatureEnabled.new(name: 'user_lost_password').execute
  10. user = ::User.by_reset_token(token)
  11. raise InvalidTokenError if !user
  12. user
  13. end
  14. class InvalidTokenError < StandardError
  15. def initialize
  16. super(__('The provided token is invalid.'))
  17. end
  18. end
  19. end