diff --git a/lib/galaxy/managers/users.py b/lib/galaxy/managers/users.py index 2196857cf479..e92aafcd23e4 100644 --- a/lib/galaxy/managers/users.py +++ b/lib/galaxy/managers/users.py @@ -608,8 +608,9 @@ def send_reset_email(self, trans, payload, **kwd): except Exception as e: log.debug(body) return f"Failed to submit email. Please contact the administrator: {util.unicodify(e)}" - else: - return "Failed to produce password reset token. User not found." + if not reset_user: + log.warning(f"Failed to produce password reset token. User with email '{email}' not found.") + return None def get_reset_token(self, trans, email): reset_user = get_user_by_email(trans.sa_session, email, self.app.model.User) diff --git a/lib/galaxy/webapps/galaxy/controllers/user.py b/lib/galaxy/webapps/galaxy/controllers/user.py index e661f3c40afe..d8c1ed5541c4 100644 --- a/lib/galaxy/webapps/galaxy/controllers/user.py +++ b/lib/galaxy/webapps/galaxy/controllers/user.py @@ -342,7 +342,7 @@ def reset_password(self, trans, payload=None, **kwd): payload = payload or {} if message := self.user_manager.send_reset_email(trans, payload): return self.message_exception(trans, message) - return {"message": "Reset link has been sent to your email."} + return {"message": "If an account exists for this email address a confirmation email will be dispatched."} def __get_redirect_url(self, redirect): if not redirect or redirect == "None": diff --git a/test/unit/app/managers/test_UserManager.py b/test/unit/app/managers/test_UserManager.py index b8286838d103..8bd1807c50c1 100644 --- a/test/unit/app/managers/test_UserManager.py +++ b/test/unit/app/managers/test_UserManager.py @@ -240,7 +240,7 @@ def test_reset_email_user_deleted(self): 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." + assert message is None def test_get_user_by_identity(self): # return None if username/email not found