Class: Users::ValidateManualOtpService
- Inherits:
-
BaseService
- Object
- BaseService
- Users::ValidateManualOtpService
- Defined in:
- app/services/users/validate_manual_otp_service.rb
Instance Attribute Summary
Attributes inherited from BaseService
#current_user, #params, #project
Instance Method Summary collapse
- #execute(otp_code) ⇒ Object
-
#initialize(current_user) ⇒ ValidateManualOtpService
constructor
A new instance of ValidateManualOtpService.
Methods included from Gitlab::Auth::Otp::DuoAuth
Methods included from BaseServiceUtility
#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level
Methods included from Gitlab::Allowable
Constructor Details
#initialize(current_user) ⇒ ValidateManualOtpService
Returns a new instance of ValidateManualOtpService.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/services/users/validate_manual_otp_service.rb', line 8 def initialize(current_user) @current_user = current_user @strategy = if forti_authenticator_enabled?(current_user) ::Gitlab::Auth::Otp::Strategies::FortiAuthenticator::ManualOtp.new(current_user) elsif forti_token_cloud_enabled?(current_user) ::Gitlab::Auth::Otp::Strategies::FortiTokenCloud.new(current_user) elsif duo_auth_enabled?(current_user) ::Gitlab::Auth::Otp::Strategies::DuoAuth::ManualOtp.new(current_user) else ::Gitlab::Auth::Otp::Strategies::Devise.new(current_user) end end |
Instance Method Details
#execute(otp_code) ⇒ Object
21 22 23 24 25 26 |
# File 'app/services/users/validate_manual_otp_service.rb', line 21 def execute(otp_code) strategy.validate(otp_code) rescue StandardError => ex Gitlab::ErrorTracking.log_exception(ex) error(ex.) end |