mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-11 01:44:34 +08:00
Merge pull request #3289 from biosistemika/SCI-5698-fix-force-2fa
SCI-5698 fix force 2fa
This commit is contained in:
commit
1c20c02686
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