prefilter_app / src /auth.py
mtyrrell's picture
Changed criteria range; added delay for Azure API call; refactored
6506ce9
raw
history blame contribute delete
457 Bytes
import os
import bcrypt
# Helper functions
def check_password(provided_password, stored_hash):
return bcrypt.checkpw(provided_password.encode(), stored_hash)
def validate_login(username, password):
# Retrieve user's hashed password from environment variables
user_hash = os.getenv(username.upper() + '_HASH') # Assumes an env var like 'USER1_HASH'
if user_hash:
return check_password(password, user_hash.encode())
return False