Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ✨ social-auth auto associate existing user #458

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

goztrk
Copy link
Contributor

@goztrk goztrk commented Dec 13, 2024

Description

Allows desired social auth backends to be defined as auto-associate. This will allow to associate social accounts with existing accounts in the pipeline automatically.

@goztrk goztrk self-assigned this Dec 13, 2024
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer's Note

Most of this is formatting. The important part is marked with a comment.

Comment on lines +96 to +106
# A user is already associated with this email
auto_associate_backends = htk_setting(
'HTK_ACCOUNTS_SOCIAL_AUTO_ASSOCIATE_BACKENDS', []
)
backend_name = backend.name
if backend_name in auto_associate_backends:
# The backend is one of the auto-associate backends, so we need to
# associate the Django user with the social auth account
# This is a job for `associate_user` pipeline but the association
# must happen in here.
associate_user(backend, uid, user=user)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer's Note

The main change!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant