Reputation: 11
I would like to know if anyone knows if there is a way to make django-social-auth throw an error if the social account is not associated to a site account and not to register a new user?
Upvotes: 0
Views: 997
Reputation: 3701
You can make that possible by overriding the pipeline setting with one that drops create_user
entry (there's an example in the pipeline docs at http://python-social-auth-docs.readthedocs.io/en/latest/pipeline.html). Basically define this setting:
SOCIAL_AUTH_PIPELINE = (
'social_auth.backends.pipeline.social.social_auth_user',
'social_auth.backends.pipeline.social.associate_user',
'social_auth.backends.pipeline.social.load_extra_data',
'social_auth.backends.pipeline.user.update_user_details'
)
Also you could add your own entry that does the check for you, like this:
def user_must_exists(user=None, *args, **kwargs):
if user is None:
raise YourExceptionHere()
Upvotes: 0