fix: fix error of secret

This commit is contained in:
roai_linux 2026-03-30 11:56:45 +03:30
parent 017046dafd
commit 6476233f29
5 changed files with 7 additions and 7 deletions

View File

@ -10,7 +10,7 @@ class Settings(BaseSettings):
ACCESS_TOKEN_EXPIRE_DAYS: int = 1
REFRESH_TOKEN_EXPIRE_WEEKS: int = 12
ALGORITHM: str = "HS256"
SECRET_PASS_LENGTH: int
SECRET_PASS_LENGTH: int = 4
DATABASE_URL: str
REDIS_URL: str

View File

@ -76,7 +76,7 @@ services:
condition: service_healthy
api:
build: .
image: back-api
container_name: neda_api
ports:
- "8000:8000"

View File

@ -11,10 +11,10 @@ from domains.users.repo import (
)
from core.security import hash_password
from core.config import Settings
from core.config import settings
def generate_user_secret():
return secrets.token_urlsafe(Settings.SECRET_PASS_LENGTH)
return secrets.token_urlsafe(settings.SECRET_PASS_LENGTH)
async def admin_create_user(
db: AsyncSession,

View File

@ -17,7 +17,7 @@ turn:
key_file: "/etc/letsencrypt/live/pathfinder.wikm.ir/privkey.pem"
tls_port: 5349
udp_port: 3478
external_tls: false
external_tls: false
domain: "pathfinder.wikm.ir"
#######################################################

View File

@ -4,12 +4,12 @@ import secrets
from db.session import AsyncSessionLocal
from domains.users.models import User
from core.security import hash_password
from core.config import Settings
from core.config import settings
async def create_admin() -> None:
username = input("Admin username: ").strip()
phone_number = input("Phone number (optional, 11 digits): ").strip() or None
secret = secrets.token_urlsafe(Settings.SECRET_PASS_LENGTH)
secret = secrets.token_urlsafe(settings.SECRET_PASS_LENGTH)
async with AsyncSessionLocal() as db:
try: