-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18459 from laperlej/reset_password_deleted_user
[24.0] Disable password reset for deleted users [GCC2024_COFEST]
- Loading branch information
Showing
2 changed files
with
11 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -232,6 +232,16 @@ def validate_send_email(frm, to, subject, body, config, html=None): | |
mock_unique_id.assert_called_once() | ||
assert result is None | ||
|
||
def test_reset_email_user_deleted(self): | ||
self.trans.app.config.allow_user_deletion = True | ||
self.log("should not produce the password reset email if user is deleted") | ||
user_email = "[email protected]" | ||
user = self.user_manager.create(email=user_email, username="nopassword") | ||
self.user_manager.delete(user) | ||
assert user.deleted is True | ||
message = self.user_manager.send_reset_email(self.trans, {"email": user_email}) | ||
assert message == "Failed to produce password reset token. User not found." | ||
|
||
def test_get_user_by_identity(self): | ||
# return None if username/email not found | ||
assert self.user_manager.get_user_by_identity("xyz") is None | ||
|