mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-27 18:52:07 +08:00
SCI-5693 skip 2fa if bypass is set
This commit is contained in:
parent
47f64fb711
commit
f23ff73610
1 changed files with 5 additions and 2 deletions
|
@ -2,7 +2,6 @@
|
|||
|
||||
class Users::SessionsController < Devise::SessionsController
|
||||
layout :session_layout
|
||||
|
||||
after_action :after_sign_in, only: %i(create authenticate_with_two_factor)
|
||||
before_action :remove_authenticate_mesasge_if_root_path, only: :new
|
||||
|
||||
|
@ -23,7 +22,7 @@ class Users::SessionsController < Devise::SessionsController
|
|||
# POST /resource/sign_in
|
||||
def create
|
||||
super do |user|
|
||||
if user.two_factor_auth_enabled?
|
||||
if user.two_factor_auth_enabled? && !bypass_two_factor_auth?
|
||||
sign_out
|
||||
session[:otp_user_id] = user.id
|
||||
store_location_for(:user, request.original_fullpath) if request.get?
|
||||
|
@ -111,4 +110,8 @@ class Users::SessionsController < Devise::SessionsController
|
|||
'layouts/main'
|
||||
end
|
||||
end
|
||||
|
||||
def bypass_two_factor_auth?
|
||||
false
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue