Implement phone number normalization and access control for Telegram users
- Added functionality to normalize phone numbers for comparison, ensuring only digits are stored and checked. - Updated configuration to include optional phone number allowlists for users and admins in the environment settings. - Enhanced authentication logic to allow access based on normalized phone numbers, in addition to usernames. - Introduced new helper functions for parsing and validating phone numbers, improving code organization and maintainability. - Added unit tests to validate phone normalization and access control based on phone numbers.
This commit is contained in:
@@ -7,6 +7,10 @@ HTTP_PORT=8080
|
||||
ALLOWED_USERNAMES=username1,username2
|
||||
ADMIN_USERNAMES=admin1,admin2
|
||||
|
||||
# Optional: allow by phone (user sets phone via /set_phone in bot). Comma-separated; normalized to digits for comparison.
|
||||
# ALLOWED_PHONES=79001234567,79007654321
|
||||
# ADMIN_PHONES=79001111111
|
||||
|
||||
# Dev only: set to 1 to allow calendar without Telegram initData (insecure; do not use in production).
|
||||
# MINI_APP_SKIP_AUTH=1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user