最善のオプションは、認証パイプラインを変更し、social_auth / backend / pipelines/associate.pyにあるこの関数の独自のバージョンを作成することだと思います。
defassociate_by_email(details、* args、** kwargs):"""詳細で返されたものと同じメールアドレスでユーザーエントリを返します。"""email = details.get('email')
warn_setting('SOCIAL_AUTH_ASSOCIATE_BY_MAIL', 'associate_by_email')
if email and setting('SOCIAL_AUTH_ASSOCIATE_BY_MAIL', True):
# try to associate accounts registered with the same email address,
# only if it's a single object. AuthException is raised if multiple
# objects are returned
try:
return {'user': User.objects.get(email=email)}
except MultipleObjectsReturned:
raise AuthException(kwargs['backend'], 'Not unique email address.')
except User.DoesNotExist:
pass
この行を置き換える場合:
passステートメントに対してAuthException(kwargs ['backend']、'Not unique email address。')
を発生させ、データベースに重複する電子メールがある場合(つまり、特定のアカウントに関連付けることができない) 、電子メールでの関連付けを試みず、代わりにパイプラインの次のアイテムに渡します。最終的には、これにより新しいアカウントが作成されるはずです。