mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Merge pull request #5848 from OsamaSayegh/fix-social-login-groups
FIX: apply automatic group rules when using social login providers
This commit is contained in:
@@ -21,7 +21,10 @@ class UserAuthenticator
|
||||
end
|
||||
|
||||
def finish
|
||||
authenticator.after_create_account(@user, @session) if authenticator
|
||||
if authenticator
|
||||
authenticator.after_create_account(@user, @session)
|
||||
confirm_email
|
||||
end
|
||||
@session = nil
|
||||
end
|
||||
|
||||
@@ -30,11 +33,18 @@ class UserAuthenticator
|
||||
end
|
||||
|
||||
def authenticated?
|
||||
@session && @session[:email] == @user.email && @session[:email_valid]
|
||||
@session && @session[:email]&.downcase == @user.email.downcase && @session[:email_valid].to_s == "true"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def confirm_email
|
||||
if authenticated?
|
||||
EmailToken.confirm(@user.email_tokens.first.token)
|
||||
@user.set_automatic_groups
|
||||
end
|
||||
end
|
||||
|
||||
def authenticator
|
||||
if authenticator_name
|
||||
@authenticator ||= @authenticator_finder.find_authenticator(authenticator_name)
|
||||
|
||||
Reference in New Issue
Block a user