about summary refs log tree commit diff
path: root/app/controllers
diff options
context:
space:
mode:
authorfuyu <54523771+mfmfuyu@users.noreply.github.com>2020-06-20 20:30:13 +0900
committerGitHub <noreply@github.com>2020-06-20 13:30:13 +0200
commita279acc73071b3fb2f8381fc5051de5b70e879ef (patch)
tree5d99bdb4c7d428b927ad9f60dc4db1fbbf4c3440 /app/controllers
parentac8a788370012656cde08b2aea2bd927f0748422 (diff)
Fix not working I18n on 2FA and Sign in token page (#14087)
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/concerns/localized.rb4
-rw-r--r--app/controllers/concerns/sign_in_token_authentication_concern.rb8
-rw-r--r--app/controllers/concerns/two_factor_authentication_concern.rb8
3 files changed, 12 insertions, 8 deletions
diff --git a/app/controllers/concerns/localized.rb b/app/controllers/concerns/localized.rb
index d1384ed56..fe1142f34 100644
--- a/app/controllers/concerns/localized.rb
+++ b/app/controllers/concerns/localized.rb
@@ -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
diff --git a/app/controllers/concerns/sign_in_token_authentication_concern.rb b/app/controllers/concerns/sign_in_token_authentication_concern.rb
index a177aacaf..91f813acc 100644
--- a/app/controllers/concerns/sign_in_token_authentication_concern.rb
+++ b/app/controllers/concerns/sign_in_token_authentication_concern.rb
@@ -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
diff --git a/app/controllers/concerns/two_factor_authentication_concern.rb b/app/controllers/concerns/two_factor_authentication_concern.rb
index cdd8d14af..daafe56f4 100644
--- a/app/controllers/concerns/two_factor_authentication_concern.rb
+++ b/app/controllers/concerns/two_factor_authentication_concern.rb
@@ -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