Fixed exception being raised when setting all numeric password to access the web UI

This commit is contained in:
S Dellysse 2023-12-08 14:20:00 -05:00 committed by GitHub
parent 058a00594e
commit 256ceeb598
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -519,7 +519,7 @@ def save_settings(settings_items):
if key == 'settings-auth-password':
if value != settings.auth.password and value is not None:
value = hashlib.md5(value.encode('utf-8')).hexdigest()
value = hashlib.md5(f"{value}".encode('utf-8')).hexdigest()
if key == 'settings-general-debug':
configure_debug = True

View File

@ -14,7 +14,7 @@ def check_credentials(user, pw, request, log_success=True):
ip_addr = request.environ.get('HTTP_X_FORWARDED_FOR', request.remote_addr)
username = settings.auth.username
password = settings.auth.password
if hashlib.md5(pw.encode('utf-8')).hexdigest() == password and user == username:
if hashlib.md5(f"{pw}".encode('utf-8')).hexdigest() == password and user == username:
if log_success:
logging.info(f'Successful authentication from {ip_addr} for user {user}')
return True