Spaces:
Sleeping
Sleeping
| import json | |
| import os | |
| def load_access_json(file_path: str) -> dict: | |
| """Load the JSON file containing the allowed emails.""" | |
| with open(file_path, 'r') as f: | |
| return json.load(f) | |
| def authenticator(email: str, token: str, auth_token: str, access_json_path: str) -> bool: | |
| """Check if the provided email and token are valid.""" | |
| emails_data = load_access_json(access_json_path) | |
| email_list = emails_data["email"] | |
| return (email.lower() in email_list) and (token == auth_token) | |