我最近做了类似的定制。您必须覆盖默认值SOCIAL_AUTH_PIPELINE
。我建议您编写一些处理程序并在管道中替换相同的处理程序。有关更多详细信息,您可以参考http://django-social-auth.readthedocs.org/en/latest/pipeline.html
我的增强管道:
SOCIAL_AUTH_PIPELINE = (
'social_auth.backends.pipeline.social.social_auth_user',
# Removed by default since it can be a dangerouse behavior that
# could lead to accounts take over.
#'social_auth.backends.pipeline.associate.associate_by_email',
'social_auth.backends.pipeline.user.get_username',
#'social_auth.backends.pipeline.user.create_user',
'myproject.custom.create_user',
'social_auth.backends.pipeline.social.associate_user',
#'social_auth.backends.pipeline.social.load_extra_data',
'myproject.custom.load_extra_data',
'social_auth.backends.pipeline.user.update_user_details',
)