Skip to content

Commit

Permalink
Merge branch 'release_24.0' into release_24.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nsoranzo committed Jul 8, 2024
2 parents 0d0e2a1 + 9a658ae commit 49f820d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
5 changes: 3 additions & 2 deletions lib/galaxy/managers/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,8 +609,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)
Expand Down
11 changes: 6 additions & 5 deletions lib/galaxy/tool_util/biotools/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@ def __init__(self, cache=None):

def _raw_get_metadata(self, biotools_reference) -> Optional[str]:
api_url = f"https://bio.tools/api/tool/{biotools_reference}?format=json"
req = requests.get(api_url, timeout=DEFAULT_SOCKET_TIMEOUT)
req.encoding = req.apparent_encoding
if req.status_code == 404:
return None
else:
try:
req = requests.get(api_url, timeout=DEFAULT_SOCKET_TIMEOUT)
req.raise_for_status()
req.encoding = req.apparent_encoding
return req.text
except Exception:
return None

def get_biotools_metadata(self, biotools_reference: str) -> Optional[BiotoolsEntry]:
createfunc = functools.partial(self._raw_get_metadata, biotools_reference)
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/webapps/galaxy/controllers/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
2 changes: 1 addition & 1 deletion test/unit/app/managers/test_UserManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 49f820d

Please sign in to comment.