Skip to content

Commit

Permalink
Add email exists check on recovery username form.
Browse files Browse the repository at this point in the history
  • Loading branch information
wlorenzetti committed Nov 15, 2023
1 parent b6ed5dd commit 6a58099
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion g3w-admin/usersmanage/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,18 @@ def clean_email(self):


class G3WUsernameRecoveryForm(G3WreCaptchaFormMixin, PasswordResetForm):
pass

def clean_email(self):
"""
Email exists into db
:return: Cleaned data email
"""

if not User.objects.filter(email=self.cleaned_data['email']).exists():
raise ValidationError(_('No user is available with this email.'), code='email_invalid')

return self.cleaned_data['email']



0 comments on commit 6a58099

Please sign in to comment.