Django Allauth在无效的注册表单上创建帐户

时间:2019-04-18 03:32:56

标签: django allauth

我正在使用Django Allauth v0.36,即使表单无效,注册表单也会创建该帐户。表单无效时,它不会重定向或登录用户,它停留在注册页面上并显示来自无效消息。当我尝试使用相同的凭据进行注册时,它说该帐户已存在,数据库显示创建的帐户。

知道为什么会这样吗?

以下是我的设置列表:

ACCOUNT_ADAPTER = 'allauth.account.adapter.DefaultAccountAdapter'
#ACCOUNT_AUTHENTICATED_LOGIN_REDIRECTS = True # By changing this setting to False, logged in users will not be redirected when they access login/signup pages.
ACCOUNT_AUTHENTICATION_METHOD = 'username_email' # User can login with username or email
ACCOUNT_USERNAME_REQUIRED = False  # TODO: What about HOS Users??

ACCOUNT_CONFIRM_EMAIL_ON_GET = False
ACCOUNT_EMAIL_CONFIRMATION_ANONYMOUS_REDIRECT_URL = LOGIN_URL
ACCOUNT_EMAIL_CONFIRMATION_AUTHENTICATED_REDIRECT_URL = '/'
ACCOUNT_EMAIL_CONFIRMATION_COOLDOWN = 180

ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DAYS = 1
# Determines the expiration date of email confirmation mails (# of days).
ACCOUNT_EMAIL_CONFIRMATION_HMAC = True
# In order to verify an email address a key is mailed identifying the email address to be verified. In previous versions, a record was stored in the database for each ongoing email confirmation, keeping track of these keys. Current versions use HMAC based keys that do not require server side state.
ACCOUNT_EMAIL_REQUIRED = True
# Determines the e-mail verification method during signup – choose one of "mandatory", "optional", or "none". When set to “mandatory” the user is blocked from logging in until the email address is verified. Choose “optional” or “none” to allow logins with an unverified e-mail address. In case of “optional”, the e-mail verification mail is still sent, whereas in case of “none” no e-mail verification mails are sent.
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
# Determines the e-mail verification method during signup – choose one of "mandatory", "optional", or "none". When set to “mandatory” the user is blocked from logging in until the email address is verified. Choose “optional” or “none” to allow logins with an unverified e-mail address. In case of “optional”, the e-mail verification mail is still sent, whereas in case of “none” no e-mail verification mails are sent.
ACCOUNT_EMAIL_SUBJECT_PREFIX ='Mod Technologies LLC '
# Subject-line prefix to use for email messages sent. By default, the name of the current Site (django.contrib.sites) is used.
ACCOUNT_DEFAULT_HTTP_PROTOCOL ='http'

# Security
ACCOUNT_LOGIN_ATTEMPTS_LIMIT = 5
ACCOUNT_LOGIN_ATTEMPTS_TIMEOUT = 86400

ACCOUNT_LOGOUT_ON_GET = False
ACCOUNT_LOGOUT_REDIRECT_URL ='/'
ACCOUNT_SIGNUP_FORM_CLASS = None            #Custom Content -> 'users.forms.SignupForm'
ACCOUNT_SIGNUP_PASSWORD_ENTER_TWICE = True
ACCOUNT_UNIQUE_EMAIL = True
ACCOUNT_USER_MODEL_EMAIL_FIELD ='email'
ACCOUNT_USER_MODEL_USERNAME_FIELD ='username'

ACCOUNT_USERNAME_MIN_LENGTH = 5
ACCOUNT_USERNAME_REQUIRED = True
ACCOUNT_LOGIN_ON_EMAIL_CONFIRMATION = True  # The default behaviour is not log users in and to redirect them to ACCOUNT_EMAIL_CONFIRMATION_ANONYMOUS_REDIRECT_URL
#By changing this setting to True, users will automatically be logged in once they confirm their email address. Note however that this only works when confirming the email address immediately after signing up, assuming users didn’t close their browser or used some sort of private browsing mode.

0 个答案:

没有答案