diff --git a/hc/accounts/tests/test_profile.py b/hc/accounts/tests/test_profile.py index 782e88a6..fb612899 100644 --- a/hc/accounts/tests/test_profile.py +++ b/hc/accounts/tests/test_profile.py @@ -9,6 +9,7 @@ class ProfileTestCase(BaseTestCase): r = self.client.get("/accounts/profile/") self.assertContains(r, "Email and Password") + self.assertContains(r, "Change Password") def test_leaving_works(self): self.client.login(username="bob@example.org", password="password") @@ -75,3 +76,15 @@ class ProfileTestCase(BaseTestCase): self.client.login(username="alice@example.org", password="password") r = self.client.get("/accounts/profile/") self.assertContains(r, "Alices Key") + + def test_it_handles_unusable_password(self): + self.alice.set_unusable_password() + self.alice.save() + + # Authenticate using the ProfileBackend and a token: + token = self.profile.prepare_token("login") + self.client.login(username="alice", token=token) + + r = self.client.get("/accounts/profile/") + self.assertContains(r, "Set Password") + self.assertNotContains(r, "Change Password") diff --git a/static/css/profile.css b/static/css/profile.css index 3268e29a..39440c80 100644 --- a/static/css/profile.css +++ b/static/css/profile.css @@ -65,3 +65,7 @@ span.loading { #my-keys th { border-top: 0; } + +.settings-bar { + line-height: 34px; +} \ No newline at end of file diff --git a/templates/accounts/profile.html b/templates/accounts/profile.html index 3fc3cf34..e596df53 100644 --- a/templates/accounts/profile.html +++ b/templates/accounts/profile.html @@ -38,7 +38,7 @@
{% csrf_token %}

Email and Password

-

+

Your account's email address is {{ request.user.email }} @@ -47,12 +47,21 @@ class="btn btn-default pull-right">Change Email

-

- Attach a password to your {{ site_name }} account + {% if request.user.has_usable_password %} +

+ Password authentication is enabled. + Change Password +

+ {% else %} +

+ Attach a password to your {{ site_name }} account. Set Password

+ {% endif %}
{% if changed_password %}