Skip to content

Commit 8276ab8

Browse files
authored
overwrite after_authenticate to check UserAssociatedAccount
1 parent 1f08770 commit 8276ab8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

plugin.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@ def can_connect_existing_user?
2525
def enabled?
2626
SiteSetting.openid_connect_enabled
2727
end
28+
29+
def after_authenticate(auth_token, existing_account: nil)
30+
Rails.logger.info("after_authenticate called")
31+
result = super(auth_token, existing_account: existing_account)
32+
if existing_account
33+
association = UserAssociatedAccount.find_by(user_id: existing_account.id, provider_name: auth_token[:provider], provider_uid: auth_token[:uid])
34+
if association.nil?
35+
Rails.logger.info("no associated_account found for this uuid")
36+
end
37+
end
38+
39+
result
40+
end
2841

2942
def register_middleware(omniauth)
3043

0 commit comments

Comments
 (0)