BOT_open_sesam/auth.py

24 lines
618 B
Python
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

ALLOWED_PHONE_NUMBERS = [
"+79000959392",
]
AUTHORIZED_USERS = {}
def check_user_auth(phone: str) -> bool:
return phone in ALLOWED_PHONE_NUMBERS
def authorize_user(user_id: int, phone: str) -> bool:
if check_user_auth(phone):
AUTHORIZED_USERS[user_id] = phone
print(f"{user_id} авторизован с номером: {phone}")
return True
else:
print(f"Пользователь {user_id} пытался авторизоваться с номером {phone}")
return False
def is_user_auth(user_id: int) -> bool:
return user_id in AUTHORIZED_USERS