mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
FEATURE: Experimental support for group membership via google auth (#14835)
This commit introduces a new site setting "google_oauth2_hd_groups". If enabled, group information will be fetched from Google during authentication, and stored in the Discourse database. These 'associated groups' can be connected to a Discourse group via the "Membership" tab of the group preferences UI. The majority of the implementation is generic, so we will be able to add support to more authentication methods in the near future. https://meta.discourse.org/t/managing-group-membership-via-authentication/175950
This commit is contained in:
@ -113,14 +113,16 @@ class Auth::ManagedAuthenticator < Auth::Authenticator
|
||||
result
|
||||
end
|
||||
|
||||
def after_create_account(user, auth)
|
||||
auth_token = auth[:extra_data]
|
||||
def after_create_account(user, auth_result)
|
||||
auth_token = auth_result[:extra_data]
|
||||
association = UserAssociatedAccount.find_or_initialize_by(provider_name: auth_token[:provider], provider_uid: auth_token[:uid])
|
||||
association.user = user
|
||||
association.save!
|
||||
|
||||
retrieve_avatar(user, association.info["image"])
|
||||
retrieve_profile(user, association.info)
|
||||
|
||||
auth_result.apply_associated_attributes!
|
||||
end
|
||||
|
||||
def find_user_by_email(auth_token)
|
||||
|
Reference in New Issue
Block a user