DSA already supports multiple account associations, the trick is that the user must log in, otherwise the DSA does not know that it must be associated with an existing account.
As for your profile, the recommended way to add functionality to DSA is to expand the pipeline , you can create an entry similar to this:
def create_profile(user, is_new=False, *args, **kwargs):
if is_new:
create_user_profile(user)
Then register it in the following settings:
SOCIAL_AUTH_PIPELINE = (
'social_auth.backends.pipeline.social.social_auth_user',
'social_auth.backends.pipeline.user.get_username',
'social_auth.backends.pipeline.user.create_user',
'social_auth.backends.pipeline.social.associate_user',
'social_auth.backends.pipeline.social.load_extra_data',
'social_auth.backends.pipeline.user.update_user_details',
'myapp.pipeline.create_profile'
)
If the record is the import path to get this function.
Edit: link to documents and setting explanations.
source
share