]> cat aescling's git repositories - mastodon.git/commitdiff
Fix not working I18n on 2FA and Sign in token page (#14087)
authorfuyu <54523771+mfmfuyu@users.noreply.github.com>
Sat, 20 Jun 2020 11:30:13 +0000 (20:30 +0900)
committerGitHub <noreply@github.com>
Sat, 20 Jun 2020 11:30:13 +0000 (13:30 +0200)
app/controllers/concerns/localized.rb
app/controllers/concerns/sign_in_token_authentication_concern.rb
app/controllers/concerns/two_factor_authentication_concern.rb

index d1384ed56ff38f232822a31b83093f3a11435d66..fe1142f34530d1af9245c6b44302498a597363f9 100644 (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
index a177aacafa54c1c81aa9c1f008ab7a8d25696d55..91f813acc3508c06d88de491734290d6a92a6ab2 100644 (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
index cdd8d14afedd938111412705dcdb9a4edeca7715..daafe56f4602d4cab477359ccf968c38e7ef30c0 100644 (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