catch ValueError on verify, adjust log level for failed logins

This commit is contained in:
Peter Bieringer 2025-03-08 17:27:02 +01:00
parent a284d18c16
commit 41ab96e142

View file

@ -286,12 +286,16 @@ class Auth(auth.BaseAuth):
login_ok = True
if login_ok is True:
(method, password_ok) = self._verify(digest, password)
try:
(method, password_ok) = self._verify(digest, password)
except ValueError as e:
logger.warning("Login verification failed for user: '%s' (method '%s') %s", login, self._encryption, e)
return ""
logger.debug("Login verification successful for user: '%s' (method '%s')", login, method)
if password_ok:
return login
else:
logger.debug("Login verification failed for user: '%s' ( method '%s')", login, method)
logger.warning("Login verification failed for user: '%s' (method '%s')", login, method)
else:
logger.debug("Login verification user not found: '%s'", login)
logger.warning("Login verification user not found: '%s'", login)
return ""