Commit 22bebb60 authored by Chris Lamb's avatar Chris Lamb
Browse files

Require that users have a validated email address before they can login. (re. #18)

parent 1306b404
......@@ -28,3 +28,11 @@ class AuthenticationForm(django_forms.AuthenticationForm):
self.confirm_login_allowed(self.user_cache)
return self.cleaned_data
def confirm_login_allowed(self, user):
super().confirm_login_allowed(user)
if user.email_validated is None:
raise forms.ValidationError(
"Please check your email for your confirmation email."
)
......@@ -24,6 +24,9 @@ class TestCase(TestCase):
'password',
)
self.user.email_validated = self.user.date_joined
self.user.save()
Profile.objects.create(
user=self.user,
name="Profile name",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment