Send a email notification when a password was changed or reset #93588

Merged
Oleg-Komarov merged 2 commits from password-changed-email into main 2024-08-05 16:45:46 +02:00
Showing only changes of commit 802c6c1fa0 - Show all commits

View File

@ -48,8 +48,22 @@ class PasswordChangedEmailTest(TestCase):
new_password = get_random_string(16) new_password = get_random_string(16)
response = self.client.get(password_reset_link) response = self.client.get(password_reset_link)
self.assertEqual(response.status_code, 302) self.assertEqual(response.status_code, 302)
submit_url = response['Location']
# mess up the input, don't get a notification
response = self.client.post( response = self.client.post(
response['Location'], submit_url,
{
'new_password1': new_password,
'new_password2': 'some other string',
},
)
self.assertEqual(response.status_code, 200)
self.assertEqual(len(mail.outbox), 0)
# submit correctly, get a notification
response = self.client.post(
submit_url,
{ {
'new_password1': new_password, 'new_password1': new_password,
'new_password2': new_password, 'new_password2': new_password,