mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge branch 'release_24.0' into release_24.1
This commit is contained in:
@@ -609,8 +609,9 @@ class UserManager(base.ModelManager, deletable.PurgableManagerMixin):
|
||||
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)
|
||||
|
||||
@@ -55,12 +55,13 @@ class ApiBiotoolsMetadataSource(BiotoolsMetadataSource):
|
||||
|
||||
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)
|
||||
|
||||
@@ -342,7 +342,7 @@ class User(BaseUIController, UsesFormDefinitionsMixin):
|
||||
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":
|
||||
|
||||
@@ -240,7 +240,7 @@ class TestUserManager(BaseTestCase):
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user