Django all-auth 允许用户仅在验证用户电子邮件地址后才能登录

Django all-auth allow users to login only if the user email address is verified

如何覆盖 AllAuth 默认登录视图以允许用户仅在其电子邮件地址经过验证后才能登录?

来自Aullauth configuration docs

您需要设置:ACCOUNT_EMAIL_VERIFICATION="mandatory"

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_REQUIRED=True

Setting this to “mandatory” requires ACCOUNT_EMAIL_REQUIRED to be True