我设法通过稍微更改适配器的代码来使其工作。
adapter.py
from allauth.socialaccount.adapter import DefaultSocialAccountAdapterclass MySocialAccountAdapter(DefaultSocialAccountAdapter): def pre_social_login(self, request, sociallogin): user = sociallogin.user if user.id: return try: customer = Customer.objects.get(email=user.email) # if user exists, connect the account to the existing account and login sociallogin.state['process'] = 'connect' perform_login(request, customer, 'none') except Customer.DoesNotExist: pass
如果是子类化
DefaultSocialAccountAdapter,我们必须
SOCIALACCOUNT_ADAPTER ='myapp.my_adapter.MySocialAccountAdapter'在
settings.py文件中指定
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)