Fixed password initialization mail recipients

This commit is contained in:
Éloi Rivard 2023-05-05 10:53:48 +02:00
parent c95e86832e
commit 6e6d15fec1
3 changed files with 5 additions and 2 deletions

View file

@ -21,6 +21,7 @@ Fixed
- ``OIDC.JWT.MAPPING`` configuration entry is really optional now.
- Fixed empty model attributes registration :pr:`125`
- Password initialization mails were not correctly sent. :pr:`128`
[0.0.24] - 2023-04-07
=====================

View file

@ -527,7 +527,7 @@ def profile_settings(user, username):
return profile_delete(user, edited_user)
if request.form.get("action") == "password-initialization-mail":
if send_password_initialization_mail(user):
if send_password_initialization_mail(edited_user):
flash(
_(
"A password initialization link has been sent at the user email address. It should be received within a few minutes."
@ -540,7 +540,7 @@ def profile_settings(user, username):
return profile_settings_edit(user, edited_user)
if request.form.get("action") == "password-reset-mail":
if send_password_reset_mail(user):
if send_password_reset_mail(edited_user):
flash(
_(
"A password reset link has been sent at the user email address. It should be received within a few minutes."

View file

@ -145,6 +145,7 @@ def test_password_initialization_mail(
"It should be received within a few minutes.",
) in res.flashes
assert len(smtpd.messages) == 1
assert smtpd.messages[0]["X-RcptTo"] == "john@doe.com"
u.reload()
u.password = ["correct horse battery staple"]
@ -253,6 +254,7 @@ def test_password_reset_email(smtpd, testclient, slapd_connection, logged_admin)
"It should be received within a few minutes.",
) in res.flashes
assert len(smtpd.messages) == 1
assert smtpd.messages[0]["X-RcptTo"] == "john@doe.com"
u.delete()