2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-05 08:59:27 +08:00

FIX: new sign-ups via google are added to groups

This fix ensures that users that are signing up via google oauth are
automatically added to any groups.

A similar fix will probably need to be added to other oauth providers.
This commit is contained in:
Blake Erickson 2017-07-07 14:04:56 -06:00
parent a509146ea5
commit fcfc895167
2 changed files with 19 additions and 0 deletions

View file

@ -31,6 +31,10 @@ class Auth::GoogleOAuth2Authenticator < Auth::Authenticator
def after_create_account(user, auth)
data = auth[:extra_data]
GoogleUserInfo.create({user_id: user.id}.merge(data))
if auth[:email_valid].to_s == 'true'
EmailToken.confirm(user.email_tokens.first.token)
user.set_automatic_groups
end
end
def register_middleware(omniauth)