Skip to content
Snippets Groups Projects
Unverified Commit a279acc7 authored by fuyu's avatar fuyu Committed by GitHub
Browse files

Fix not working I18n on 2FA and Sign in token page (#14087)

parent ac8a7883
No related branches found
No related tags found
No related merge requests found
......@@ -7,8 +7,6 @@ module Localized
around_action :set_locale
end
private
def set_locale
locale = current_user.locale if respond_to?(:user_signed_in?) && user_signed_in?
locale ||= session[:locale] ||= default_locale
......@@ -19,6 +17,8 @@ module Localized
end
end
private
def default_locale
if ENV['DEFAULT_LOCALE'].present?
I18n.default_locale
......
......@@ -42,8 +42,10 @@ module SignInTokenAuthenticationConcern
UserMailer.sign_in_token(user, request.remote_ip, request.user_agent, Time.now.utc.to_s).deliver_later!
end
session[:attempt_user_id] = user.id
@body_classes = 'lighter'
render :sign_in_token
set_locale do
session[:attempt_user_id] = user.id
@body_classes = 'lighter'
render :sign_in_token
end
end
end
......@@ -40,8 +40,10 @@ module TwoFactorAuthenticationConcern
end
def prompt_for_two_factor(user)
session[:attempt_user_id] = user.id
@body_classes = 'lighter'
render :two_factor
set_locale do
session[:attempt_user_id] = user.id
@body_classes = 'lighter'
render :two_factor
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment