Skip to content

Commit

Permalink
Make sure to check if an user has an email account
Browse files Browse the repository at this point in the history
  • Loading branch information
larsjeh committed Sep 23, 2019
1 parent e2563f3 commit 10e684f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions nopassword/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ def clean_username(self):
code='inactive',
)

if not user.email:
raise forms.ValidationError(
self.error_messages['invalid_username'],
code='invalid_username',
params={'username': self.username_field.verbose_name},
)

self.cleaned_data['user'] = user

return username
Expand Down

0 comments on commit 10e684f

Please sign in to comment.