File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -28,13 +28,19 @@ def enabled?
2828
2929 def after_authenticate ( auth_token , existing_account : nil )
3030 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- result . email_valid = false
37- end
31+
32+ association = UserAssociatedAccount . find_by ( provider_name : auth_token [ :provider ] , provider_uid : auth_token [ :uid ] )
33+
34+ if !association . nil?
35+ Rails . logger . info ( "associated_account #{ association . info [ "email" ] } found for this uuid" )
36+ user = association &.user
37+ Rails . logger . info ( "found user #{ user . inspect } " )
38+ result = super ( auth_token , existing_account : existing_account )
39+ else
40+ Rails . logger . info ( "no associated_account found for this uuid" )
41+ result . email_valid = false
42+ result . failed = true
43+ result . failed_reason = "wrong uuid on associated account"
3844 end
3945
4046 result
You can’t perform that action at this time.
0 commit comments