mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 13:31:18 +08:00
FEATURE: Allow connecting associated accounts when two-factor is enabled (#6754)
Previously the 'reconnect' process was a bit magic - IF you were already logged into discourse, and followed the auth flow, your account would be reconnected and you would be 'logged in again'. Now, we explicitly check for a reconnect=true parameter when the flow is started, store it in the session, and then only follow the reconnect logic if that variable is present. Setting this parameter also skips the 'logged in again' step, which means reconnect now works with 2fa enabled.
This commit is contained in:
@ -17,6 +17,12 @@ class Middleware::OmniauthBypassMiddleware
|
||||
authenticator.register_middleware(self)
|
||||
end
|
||||
end
|
||||
|
||||
@omniauth.before_request_phase do |env|
|
||||
# If the user is trying to reconnect to an existing account, store in session
|
||||
request = ActionDispatch::Request.new(env)
|
||||
request.session[:auth_reconnect] = !!request.params["reconnect"]
|
||||
end
|
||||
end
|
||||
|
||||
def call(env)
|
||||
|
Reference in New Issue
Block a user