mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-06 04:34:06 +08:00
SCI-5698 Make the decision to redirect to 2fa more readable
This commit is contained in:
parent
f23ff73610
commit
36788db816
1 changed files with 5 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue