总结上述讨论,部分摘自@alasdair
#forms.py
from django.contrib.auth.forms import PasswordResetForm
class EmailValidationOnForgotPassword(PasswordResetForm):
def clean_email(self):
email = self.cleaned_data['email']
if not User.objects.filter(email__iexact=email, is_active=True).exists():
msg = _("There is no user registered with the specified E-Mail address.")
self.add_error('email', msg)
return email
和
#urls.py
from accounts.forms import EmailValidationOnForgotPassword
path('sifre-sifirla/', PasswordResetView.as_view(form_class=EmailValidationOnForgotPassword), name='password_reset'),
@pypypy正确地说,这种方法可以用于获取用户名。单程
减少
这个问题是用一个
429 Too Many Requests
一旦用户尝试3封不同的电子邮件。例如
django-ratelimit