diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb index 8333beeb2..3ad6c6c90 100644 --- a/app/controllers/users/sessions_controller.rb +++ b/app/controllers/users/sessions_controller.rb @@ -22,7 +22,7 @@ class Users::SessionsController < Devise::SessionsController # POST /resource/sign_in def create super do |user| - if user.two_factor_auth_enabled? && !bypass_two_factor_auth? + if redirect_to_two_factor_auth?(user) sign_out session[:otp_user_id] = user.id store_location_for(:user, request.original_fullpath) if request.get? @@ -114,4 +114,8 @@ class Users::SessionsController < Devise::SessionsController def bypass_two_factor_auth? false end + + def redirect_to_two_factor_auth?(user) + user.two_factor_auth_enabled? && !bypass_two_factor_auth? + end end