diff --git a/hc/accounts/forms.py b/hc/accounts/forms.py index 97a714a1..6371c250 100644 --- a/hc/accounts/forms.py +++ b/hc/accounts/forms.py @@ -11,7 +11,7 @@ class LowercaseEmailField(forms.EmailField): class EmailPasswordForm(forms.Form): - email = LowercaseEmailField() + identity = LowercaseEmailField() password = forms.CharField(required=False) diff --git a/hc/accounts/tests/test_login.py b/hc/accounts/tests/test_login.py index 649e185c..34dbfc7b 100644 --- a/hc/accounts/tests/test_login.py +++ b/hc/accounts/tests/test_login.py @@ -17,7 +17,7 @@ class LoginTestCase(TestCase): session["welcome_code"] = str(check.code) session.save() - form = {"email": "alice@example.org"} + form = {"identity": "alice@example.org"} r = self.client.post("/accounts/login/", form) assert r.status_code == 302 @@ -47,7 +47,7 @@ class LoginTestCase(TestCase): session["welcome_code"] = "00000000-0000-0000-0000-000000000000" session.save() - form = {"email": "alice@example.org"} + form = {"identity": "alice@example.org"} r = self.client.post("/accounts/login/", form) assert r.status_code == 302 @@ -62,7 +62,7 @@ class LoginTestCase(TestCase): @override_settings(REGISTRATION_OPEN=False) def test_it_obeys_registration_open(self): - form = {"email": "dan@example.org"} + form = {"identity": "dan@example.org"} r = self.client.post("/accounts/login/", form) assert r.status_code == 200 @@ -72,7 +72,7 @@ class LoginTestCase(TestCase): alice = User(username="alice", email="alice@example.org") alice.save() - form = {"email": "ALICE@EXAMPLE.ORG"} + form = {"identity": "ALICE@EXAMPLE.ORG"} r = self.client.post("/accounts/login/", form) assert r.status_code == 302 diff --git a/hc/accounts/views.py b/hc/accounts/views.py index bf661a33..92ded0b2 100644 --- a/hc/accounts/views.py +++ b/hc/accounts/views.py @@ -78,7 +78,7 @@ def login(request, show_password=False): if request.method == 'POST': form = EmailPasswordForm(request.POST) if form.is_valid(): - email = form.cleaned_data["email"] + email = form.cleaned_data["identity"] password = form.cleaned_data["password"] if len(password): user = authenticate(username=email, password=password) diff --git a/templates/accounts/login.html b/templates/accounts/login.html index 3e98bf1b..2578dfa9 100644 --- a/templates/accounts/login.html +++ b/templates/accounts/login.html @@ -40,10 +40,9 @@ + name="identity" + value="{{ form.identity.value|default:"" }}" + placeholder="you@example.org">