verify_admin_token.rb 465 B

123456789101112131415161718192021
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Service::Auth::VerifyAdminToken < Service::Base
  3. include Service::Auth::Concerns::CheckAdminPasswordAuth
  4. attr_reader :token
  5. def initialize(token:)
  6. super()
  7. @token = token
  8. end
  9. def execute
  10. admin_password_auth!
  11. user = ::User.admin_password_auth_via_token(token)
  12. raise Exceptions::Forbidden, __('The login is not possible.') if !user
  13. user
  14. end
  15. end