Class: Admin::TwoFactorController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Admin::TwoFactorController
- Defined in:
- app/controllers/admin/two_factor_controller.rb
Constant Summary collapse
- MAX_2FA_SESSION_DURATION =
5.minutes.freeze
Instance Attribute Summary
Attributes inherited from ApplicationController
#cache, #pagination_parameters, #trusty_config
Instance Method Summary collapse
Methods inherited from ApplicationController
#after_sign_in_path_for, #initialize, #template_name
Methods included from LoginSystem
Constructor Details
This class inherits a constructor from ApplicationController
Instance Method Details
#create ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/admin/two_factor_controller.rb', line 9 def create if @user.validate_and_consume_otp!(params[:otp_attempt]) session.delete(:pre_2fa_user_id) session.delete(:pre_2fa_started_at) sign_in(:user, @user) redirect_to after_sign_in_path_for(@user) else reset_session redirect_to new_user_session_path, alert: t('two_factor_controller.invalid_code') end end |
#show ⇒ Object
7 |
# File 'app/controllers/admin/two_factor_controller.rb', line 7 def show; end |