mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-07 16:09:57 +08:00
Merge pull request #3019 from okriuchykhin/ok_SCI_4973
Fix redirects after 2FA sign in [SCI-4973]
This commit is contained in:
commit
794ba8ac0a
1 changed files with 2 additions and 2 deletions
|
@ -68,7 +68,6 @@ class Users::SessionsController < Devise::SessionsController
|
||||||
flash[:system_notification_modal] = true
|
flash[:system_notification_modal] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def authenticate_with_two_factor
|
def authenticate_with_two_factor
|
||||||
user = User.find_by(id: session[:otp_user_id])
|
user = User.find_by(id: session[:otp_user_id])
|
||||||
|
|
||||||
|
@ -83,7 +82,7 @@ class Users::SessionsController < Devise::SessionsController
|
||||||
sign_in(user)
|
sign_in(user)
|
||||||
generate_demo_project
|
generate_demo_project
|
||||||
flash[:notice] = t('devise.sessions.signed_in')
|
flash[:notice] = t('devise.sessions.signed_in')
|
||||||
redirect_to root_path
|
redirect_to stored_location_for(:user) || root_path
|
||||||
else
|
else
|
||||||
flash.now[:alert] = t('devise.sessions.2fa.error_message')
|
flash.now[:alert] = t('devise.sessions.2fa.error_message')
|
||||||
render :two_factor_auth
|
render :two_factor_auth
|
||||||
|
@ -126,6 +125,7 @@ class Users::SessionsController < Devise::SessionsController
|
||||||
|
|
||||||
if user&.two_factor_auth_enabled?
|
if user&.two_factor_auth_enabled?
|
||||||
session[:otp_user_id] = user.id
|
session[:otp_user_id] = user.id
|
||||||
|
store_location_for(:user, request.original_fullpath) if request.get?
|
||||||
render :two_factor_auth
|
render :two_factor_auth
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue