Class: Admin::TwoFactorController

Inherits:
ApplicationController show all
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

included

Constructor Details

This class inherits a constructor from ApplicationController

Instance Method Details

#createObject



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)
    (:user, @user)
    redirect_to (@user)
  else
    reset_session
    redirect_to new_user_session_path, alert: t('two_factor_controller.invalid_code')
  end
end

#showObject



7
# File 'app/controllers/admin/two_factor_controller.rb', line 7

def show; end