debian-mirror-gitlab/app/services/users/validate_push_otp_service.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
593 B
Ruby
Raw Normal View History

2021-01-03 14:25:43 +05:30
# frozen_string_literal: true
module Users
2022-07-16 23:28:13 +05:30
class ValidatePushOtpService < BaseService
2021-02-22 17:27:13 +05:30
include ::Gitlab::Auth::Otp::Fortinet
2021-01-03 14:25:43 +05:30
def initialize(current_user)
@current_user = current_user
2021-02-22 17:27:13 +05:30
@strategy = if forti_authenticator_enabled?(current_user)
2022-07-16 23:28:13 +05:30
::Gitlab::Auth::Otp::Strategies::FortiAuthenticator::PushOtp.new(current_user)
2021-01-03 14:25:43 +05:30
end
end
2022-07-16 23:28:13 +05:30
def execute
strategy.validate
2021-01-03 14:25:43 +05:30
rescue StandardError => ex
Gitlab::ErrorTracking.log_exception(ex)
2022-07-16 23:28:13 +05:30
error(ex.message)
2021-01-03 14:25:43 +05:30
end
private
attr_reader :strategy
end
end