From: Thibaut Girka Date: Fri, 13 Nov 2020 23:30:36 +0000 (+0100) Subject: Merge branch 'master' into glitch-soc/merge-upstream X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=de5cc20dd8e15eb7e90d65392a6e6f9145746913;p=mastodon.git Merge branch 'master' into glitch-soc/merge-upstream Conflicts: - `app/controllers/concerns/sign_in_token_authentication_concern.rb`: Conflict caused because of glitch-soc's theming system. Took upstream's new code and applied the theming system changes on top of it. - `app/controllers/concerns/two_factor_authentication_concern.rb`: Conflict caused because of glitch-soc's theming system. Took upstream's new code and applied the theming system changes on top of it. --- de5cc20dd8e15eb7e90d65392a6e6f9145746913 diff --cc app/controllers/auth/sessions_controller.rb index 1cf6a0a59,13d158c67..548832b21 --- a/app/controllers/auth/sessions_controller.rb +++ b/app/controllers/auth/sessions_controller.rb @@@ -7,9 -7,8 +7,10 @@@ class Auth::SessionsController < Devise skip_before_action :require_no_authentication, only: [:create] skip_before_action :require_functional! + skip_before_action :update_user_sign_in + prepend_before_action :set_pack + include TwoFactorAuthenticationConcern include SignInTokenAuthenticationConcern diff --cc app/controllers/concerns/sign_in_token_authentication_concern.rb index f5178930b,3c95a4afd..51ebcb115 --- a/app/controllers/concerns/sign_in_token_authentication_concern.rb +++ b/app/controllers/concerns/sign_in_token_authentication_concern.rb @@@ -42,11 -44,10 +44,11 @@@ module SignInTokenAuthenticationConcer UserMailer.sign_in_token(user, request.remote_ip, request.user_agent, Time.now.utc.to_s).deliver_later! end - set_locale do - session[:attempt_user_id] = user.id - use_pack 'auth' - @body_classes = 'lighter' - render :sign_in_token - end + set_attempt_session(user) ++ use_pack 'auth' + + @body_classes = 'lighter' + + set_locale { render :sign_in_token } end end diff --cc app/controllers/concerns/two_factor_authentication_concern.rb index 6b043a804,4d4ccf49c..4800db348 --- a/app/controllers/concerns/two_factor_authentication_concern.rb +++ b/app/controllers/concerns/two_factor_authentication_concern.rb @@@ -71,17 -73,18 +73,20 @@@ module TwoFactorAuthenticationConcer end def prompt_for_two_factor(user) - set_locale do - session[:attempt_user_id] = user.id - use_pack 'auth' - @body_classes = 'lighter' - @webauthn_enabled = user.webauthn_enabled? - @scheme_type = if user.webauthn_enabled? && user_params[:otp_attempt].blank? - 'webauthn' - else - 'totp' - end - render :two_factor + set_attempt_session(user) + ++ use_pack 'auth' ++ + @body_classes = 'lighter' + @webauthn_enabled = user.webauthn_enabled? + @scheme_type = begin + if user.webauthn_enabled? && user_params[:otp_attempt].blank? + 'webauthn' + else + 'totp' + end end + + set_locale { render :two_factor } end end