1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-11 04:36:48 +00:00

style(accounts): the password pages have the account forms' layout

The page where a user changes their own password and the one where an
administrator sets a user's password shared an old card: a horizontal
form, a blue Cancel and a green Change. The administrator's had Django's
"Password-based authentication: Enabled/Disabled" with a paragraph about
other backends, and its password fields stayed while Disabled was chosen.

Both pages now have the user and group forms' layout, each its own
template. The administrator chooses how the user signs in, With a
password or Without a password (such as LDAP), and the password fields
and "must change it" show only with a password; Cancel goes back to the
user. A user's own page says that their other sessions end, or, when
they must change it, that they choose one before going on, without a
Cancel. A refused password is said at its field only, without the
general "Wrong Data Provided". The section styles of these forms move
into webvirtcloud.css.
This commit is contained in:
catborise 2026-11-04 22:53:40 +03:00
parent 61979be731
commit 84dfbd5884
14 changed files with 323 additions and 193 deletions

View file

@ -57,6 +57,17 @@ class UserPagesTests(TestCase):
self.assertIn("Manages the panel: every permission, no quota.", page)
self.assertNotIn("log into this admin site", page)
def test_the_password_page_says_how_the_user_signs_in(self):
url = reverse("admin:user_update_password", args=[self.alice.pk])
page = self.client.get(url).content.decode()
self.assertIn("With a password", page)
self.assertIn("Signs in another way, such as LDAP. The current password is removed.", page)
self.assertIn(f'href="{reverse("admin:user_update", args=[self.alice.pk])}">Cancel', page)
# a mismatch is said at its field only
response = self.client.post(url, {"usable_password": "true", "password1": "Ab-123456x", "password2": "other"})
self.assertContains(response, "The two password fields didn’t match.")
self.assertNotIn("Wrong Data Provided", self.messages(response))
def test_a_refused_choice_is_said_beside_its_field(self):
url = reverse("admin:user_update", args=[self.alice.pk])
response = self.client.post(url, {"username": "up-alice", "is_active": "on", "groups": "99999", "user_permissions": "99999",