File size: 503 Bytes
fe8a467
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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)