问题
So I'm using django-allauth, even though I've found a previous post pointing to the configuration settings for setting the email verification settings, it looks like it's not working for me.
After using their facebook account to login, the user redirected to the e-mail verification form, I would like them to be signed in and be redirected to their profile page.
I have the following settings;
settings.py
ACCOUNT_USER_MODEL_USERNAME_FIELD = None
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_AUTHENTICATION_METHOD = 'email'
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
ACCOUNT_FORMS = {
'signup': 'app.users.forms.CustomSignupForm',
}
SOCIALACCOUNT_PROVIDERS = {
'facebook':
{'METHOD': 'oauth2',
'SCOPE': ['email','public_profile'],
'AUTH_PARAMS': {'auth_type': 'reauthenticate'},
'EXCHANGE_TOKEN': True,
'LOCALE_FUNC': lambda request: 'nl_NL',
'VERIFIED_EMAIL': True,
'VERSION': 'v2.4'}
}
SOCIALACCOUNT_EMAIL_VERIFICATION = 'none'
Even though I understand it is possible for facebook users to have an account without a validated e-mail adres I would still like the facebook users to be automatically logged in after signing in with their facebook account.
requirements.txt
python == 3.7
django == 2.1.3
django-allauth == 0.38.0
回答1:
Old question, but if someone has the same problem the solution is quite simple. You just have to add SOCIALACCOUNT_EMAIL_VERIFICATION = 'mandatory'
to your settings.py file.
Also if you have set ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
, social account verification will automatically be set to 'mandatory' as well.
https://django-allauth.readthedocs.io/en/latest/configuration.html (at the end of the page)
来源:https://stackoverflow.com/questions/53280805/django-allauth-require-email-verification-for-regular-accounts-but-not-for-soci