about summary refs log tree commit diff
path: root/app/controllers/concerns
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2020-06-24 15:33:41 +0200
committerThibaut Girka <thib@sitedethib.com>2020-06-24 15:33:41 +0200
commitaae60a2366d6dadbcc4a0197d4dd17afc931c8a0 (patch)
tree0bbbc278809d9990365a2d79abeaf02891990d51 /app/controllers/concerns
parent5d12b63e79953a7596ae473706985b774d4e51a6 (diff)
parentbb9ca8a587ee5a3ec8778e72828aca0ba8871327 (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
- `app/controllers/concerns/sign_in_token_authentication_concern.rb`:
  Conflict due to glitch-soc's theming system.
  Ported upstream changes.
- `app/controllers/concerns/two_factor_authentication_concern.rb`:
  Conflict due to glitch-soc's theming system.
  Ported upstream changes.
Diffstat (limited to 'app/controllers/concerns')
-rw-r--r--app/controllers/concerns/localized.rb4
-rw-r--r--app/controllers/concerns/sign_in_token_authentication_concern.rb10
-rw-r--r--app/controllers/concerns/two_factor_authentication_concern.rb10
3 files changed, 14 insertions, 10 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 88c009b19..f5178930b 100644
--- a/app/controllers/concerns/sign_in_token_authentication_concern.rb
+++ b/app/controllers/concerns/sign_in_token_authentication_concern.rb
@@ -42,9 +42,11 @@ 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
-    use_pack 'auth'
-    @body_classes = 'lighter'
-    render :sign_in_token
+    set_locale do
+      session[:attempt_user_id] = user.id
+      use_pack 'auth'
+      @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 0d9f87455..35c0c27cf 100644
--- a/app/controllers/concerns/two_factor_authentication_concern.rb
+++ b/app/controllers/concerns/two_factor_authentication_concern.rb
@@ -40,9 +40,11 @@ module TwoFactorAuthenticationConcern
   end
 
   def prompt_for_two_factor(user)
-    session[:attempt_user_id] = user.id
-    use_pack 'auth'
-    @body_classes = 'lighter'
-    render :two_factor
+    set_locale do
+      session[:attempt_user_id] = user.id
+      use_pack 'auth'
+      @body_classes = 'lighter'
+      render :two_factor
+    end
   end
 end