|
|
@ -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)
|
|
|
|
ip_addr = request.environ.get('HTTP_X_FORWARDED_FOR', request.remote_addr)
|
|
|
|
username = settings.auth.username
|
|
|
|
username = settings.auth.username
|
|
|
|
password = settings.auth.password
|
|
|
|
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:
|
|
|
|
if log_success:
|
|
|
|
logging.info(f'Successful authentication from {ip_addr} for user {user}')
|
|
|
|
logging.info(f'Successful authentication from {ip_addr} for user {user}')
|
|
|
|
return True
|
|
|
|
return True
|
|
|
|