FIX: For a single authenticator, do not interrupt registration flow

Followup to 0a14b9b42a2f597f5df26be97296a4d6909f6a34
This commit is contained in:
David Taylor
2019-11-19 19:15:11 +00:00
parent 565a967192
commit 46841888b7
2 changed files with 43 additions and 2 deletions

View File

@ -722,8 +722,9 @@ class ApplicationController < ActionController::Base
session[:destination_url] = destination_url
redirect_to path('/session/sso')
return
elsif !SiteSetting.enable_local_logins && Discourse.enabled_authenticators.length == 1
# Only one authentication provider, direct straight to it
elsif !SiteSetting.enable_local_logins && Discourse.enabled_authenticators.length == 1 && !cookies[:authentication_data]
# Only one authentication provider, direct straight to it.
# If authentication_data is present, then we are halfway though registration. Don't redirect offsite
cookies[:destination_url] = destination_url
redirect_to path("/auth/#{Discourse.enabled_authenticators.first.name}")
else