我们已经运行一个网站一段时间了,该网站使用django-allauth https://github.com/pennersr/django-allauth使用以下任一方式进行身份验证:
- 传统的基于电子邮件的注册
- 谷歌登录
- 推特登录
- Facebook登入
...但现在我们希望阻止任何人创建新帐户,同时仍然允许以前使用任何这些方法创建帐户的人能够登录。是否有一个设置可以让我们这样做?我不清楚是否有任何一个这些记录的设置 http://django-allauth.readthedocs.org/en/latest/configuration.html将允许我们配置它。
与 django-allauth 相关的当前设置是:
INSTALLED_APPS = (
'django.contrib.auth',
...
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.google',
'allauth.socialaccount.providers.facebook',
'allauth.socialaccount.providers.twitter',
...
)
AUTHENTICATION_BACKENDS = (
# Needed to login by username in Django admin, regardless of `allauth`
"django.contrib.auth.backends.ModelBackend",
# `allauth` specific authentication methods, such as login by e-mail
"allauth.account.auth_backends.AuthenticationBackend",
)
SOCIALACCOUNT_PROVIDERS = {
'google': {'SCOPE': ['https://www.googleapis.com/auth/userinfo.profile'],
'AUTH_PARAMS': {'access_type': 'online'}},
'facebook': {'SCOPE': ['email',]},
}
LOGIN_REDIRECT_URL = '/'
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_USERNAME_REQUIRED = True
SOCIALACCOUNT_AUTO_SIGNUP = True