mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 17:36:05 +00:00
fix(logs): a lost-OTP mail and a wrong old password leave a row
The "Lost OTP?" page writes a row when it mails a user their QR code link, or fails to, under the anonymous requester and their address. A password change refused for a wrong old password writes a failed row.
This commit is contained in:
parent
21b83062f7
commit
4e51a68436
3 changed files with 21 additions and 1 deletions
|
|
@ -25,6 +25,16 @@ class OwnAccountRowTests(TestCase):
|
|||
self.assertEqual(rows(), [("User bob: change email", True), ("User bob: change password", True)])
|
||||
self.assertFalse(Logs.objects.filter(message__contains="pass-").exists())
|
||||
|
||||
def test_a_wrong_old_password_is_a_failed_row(self):
|
||||
# someone at an open session guessing the password
|
||||
self.client.post(reverse("accounts:change_password"), {
|
||||
"old_password": "guess-2026", "new_password1": "Bob-new-pass-1", "new_password2": "Bob-new-pass-1"})
|
||||
self.client.get(reverse("accounts:change_password"))
|
||||
self.client.post(reverse("accounts:change_password"), { # none given: not a guess
|
||||
"new_password1": "Bob-new-pass-1", "new_password2": "Bob-new-pass-1"})
|
||||
self.assertEqual(rows(), [("User bob: change password: wrong old password", False)])
|
||||
self.assertFalse(Logs.objects.filter(message__contains="pass-").exists())
|
||||
|
||||
def test_the_first_login_password_change(self):
|
||||
self.bob.user_permissions.clear()
|
||||
UserAttributes.objects.update_or_create(user=self.bob, defaults={"must_change_password": True})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue