fix: fix error of secret
This commit is contained in:
parent
017046dafd
commit
6476233f29
|
|
@ -10,7 +10,7 @@ class Settings(BaseSettings):
|
||||||
ACCESS_TOKEN_EXPIRE_DAYS: int = 1
|
ACCESS_TOKEN_EXPIRE_DAYS: int = 1
|
||||||
REFRESH_TOKEN_EXPIRE_WEEKS: int = 12
|
REFRESH_TOKEN_EXPIRE_WEEKS: int = 12
|
||||||
ALGORITHM: str = "HS256"
|
ALGORITHM: str = "HS256"
|
||||||
SECRET_PASS_LENGTH: int
|
SECRET_PASS_LENGTH: int = 4
|
||||||
|
|
||||||
DATABASE_URL: str
|
DATABASE_URL: str
|
||||||
REDIS_URL: str
|
REDIS_URL: str
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ services:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
|
||||||
api:
|
api:
|
||||||
build: .
|
image: back-api
|
||||||
container_name: neda_api
|
container_name: neda_api
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,10 @@ from domains.users.repo import (
|
||||||
)
|
)
|
||||||
|
|
||||||
from core.security import hash_password
|
from core.security import hash_password
|
||||||
from core.config import Settings
|
from core.config import settings
|
||||||
|
|
||||||
def generate_user_secret():
|
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(
|
async def admin_create_user(
|
||||||
db: AsyncSession,
|
db: AsyncSession,
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,12 @@ import secrets
|
||||||
from db.session import AsyncSessionLocal
|
from db.session import AsyncSessionLocal
|
||||||
from domains.users.models import User
|
from domains.users.models import User
|
||||||
from core.security import hash_password
|
from core.security import hash_password
|
||||||
from core.config import Settings
|
from core.config import settings
|
||||||
|
|
||||||
async def create_admin() -> None:
|
async def create_admin() -> None:
|
||||||
username = input("Admin username: ").strip()
|
username = input("Admin username: ").strip()
|
||||||
phone_number = input("Phone number (optional, 11 digits): ").strip() or None
|
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:
|
async with AsyncSessionLocal() as db:
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user