From ae5b6a68e4102cc8ebb6833f0b2e1677993aa34f Mon Sep 17 00:00:00 2001 From: Erfan Date: Tue, 3 Sep 2024 21:53:23 +0330 Subject: [PATCH] chore: change login white list name --- .env.example | 2 +- app/routers/admin.py | 4 ++-- config.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index 3dbf00ca1..76dfe7bd8 100644 --- a/.env.example +++ b/.env.example @@ -85,7 +85,7 @@ UVICORN_PORT = 8000 # NOTIFY_LOGIN = True ## Whitelist of IPs/hosts to disable login notifications -# LOGIN_WHITE_LIST = '1.1.1.1,sub.domain.com,127.0.0.1' +# LOGIN_NOTIFY_WHITE_LIST = '1.1.1.1,127.0.0.1' ### for developers # DOCS=True diff --git a/app/routers/admin.py b/app/routers/admin.py index 9bfac2374..c17b8395a 100644 --- a/app/routers/admin.py +++ b/app/routers/admin.py @@ -8,7 +8,7 @@ from fastapi.security import OAuth2PasswordRequestForm from app.utils import report from app.dependencies import validate_admin, get_admin_by_username -from config import LOGIN_WHITE_LIST +from config import LOGIN_NOTIFY_WHITE_LIST router = APIRouter(tags=['Admin'], prefix='/api') @@ -41,7 +41,7 @@ def admin_token( headers={"WWW-Authenticate": "Bearer"}, ) - if client_ip not in LOGIN_WHITE_LIST: + if client_ip not in LOGIN_NOTIFY_WHITE_LIST: report.login(form_data.username, '🔒', client_ip, True) return Token( diff --git a/config.py b/config.py index e9fef46e4..9ea0ba9d8 100755 --- a/config.py +++ b/config.py @@ -65,7 +65,7 @@ GRPC_USER_AGENT_TEMPLATE = config("GRPC_USER_AGENT_TEMPLATE", default="user_agent/grpc.json") EXTERNAL_CONFIG = config("EXTERNAL_CONFIG", default="", cast=str) -LOGIN_WHITE_LIST = [ip.strip() for ip in config("LOGIN_WHITE_LIST", default="", cast=str).split(",") if ip.strip()] +LOGIN_NOTIFY_WHITE_LIST = [ip.strip() for ip in config("LOGIN_NOTIFY_WHITE_LIST", default="", cast=str).split(",") if ip.strip()] USE_CUSTOM_JSON_DEFAULT = config("USE_CUSTOM_JSON_DEFAULT", default=False, cast=bool) USE_CUSTOM_JSON_FOR_V2RAYN = config("USE_CUSTOM_JSON_FOR_V2RAYN", default=False, cast=bool)