Browse Source

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

master
fuyu 3 years ago
committed by GitHub
parent
commit
a279acc730
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 8 deletions
  1. +2
    -2
      app/controllers/concerns/localized.rb
  2. +5
    -3
      app/controllers/concerns/sign_in_token_authentication_concern.rb
  3. +5
    -3
      app/controllers/concerns/two_factor_authentication_concern.rb

+ 2
- 2
app/controllers/concerns/localized.rb View File

@ -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

+ 5
- 3
app/controllers/concerns/sign_in_token_authentication_concern.rb View File

@ -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

+ 5
- 3
app/controllers/concerns/two_factor_authentication_concern.rb View File

@ -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

Loading…
Cancel
Save