Module: AuthenticatesWithTwoFactor

Extended by:
ActiveSupport::Concern
Included in:
OmniauthCallbacksController, SessionsController
Defined in:
app/controllers/concerns/authenticates_with_two_factor.rb

Overview

AuthenticatesWithTwoFactor

Controller concern to handle two-factor authentication

Upon inclusion, skips `require_no_authentication` on `:create`.

Instance Method Summary collapse

Instance Method Details

#prompt_for_two_factor(user) ⇒ Object

Store the user's ID in the session for later retrieval and render the two factor code prompt

The user must have been authenticated with a valid login and password before calling this method!

user - User record

Returns nil


25
26
27
28
29
# File 'app/controllers/concerns/authenticates_with_two_factor.rb', line 25

def prompt_for_two_factor(user)
  session[:otp_user_id] = user.id

  render 'devise/sessions/two_factor' and return
end