mirror of
https://github.com/healthchecks/healthchecks.git
synced 2025-04-12 00:01:19 +00:00
Improve copy in "Profile" > "Email and Password" section
When an account has a password, replace "Set Password" button's label with "Change Password"
This commit is contained in:
parent
6d2c67338c
commit
6ed983cdd5
3 changed files with 29 additions and 3 deletions
|
@ -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")
|
||||
|
|
|
@ -65,3 +65,7 @@ span.loading {
|
|||
#my-keys th {
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
.settings-bar {
|
||||
line-height: 34px;
|
||||
}
|
|
@ -38,7 +38,7 @@
|
|||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<h2>Email and Password</h2>
|
||||
<p>
|
||||
<p class="settings-bar">
|
||||
Your account's email address is
|
||||
<code>{{ request.user.email }}</code>
|
||||
|
||||
|
@ -47,12 +47,21 @@
|
|||
class="btn btn-default pull-right">Change Email</a>
|
||||
</p>
|
||||
<p class="clearfix"></p>
|
||||
<p>
|
||||
Attach a password to your {{ site_name }} account
|
||||
{% if request.user.has_usable_password %}
|
||||
<p class="settings-bar">
|
||||
Password authentication is enabled.
|
||||
<a
|
||||
href="{% url 'hc-set-password' %}"
|
||||
class="btn btn-default pull-right">Change Password</a>
|
||||
</p>
|
||||
{% else %}
|
||||
<p class="settings-bar">
|
||||
Attach a password to your {{ site_name }} account.
|
||||
<a
|
||||
href="{% url 'hc-set-password' %}"
|
||||
class="btn btn-default pull-right">Set Password</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
</form>
|
||||
</div>
|
||||
{% if changed_password %}
|
||||
|
|
Loading…
Add table
Reference in a new issue