move variable

This commit is contained in:
Valentin CZERYBA 2023-10-13 17:54:46 +02:00
parent 86eb1dd4e5
commit 045f52eeef
2 changed files with 3 additions and 3 deletions

View File

@ -21,7 +21,7 @@ fake_users = [
SECRET_KEY = "09d25e094faa6ca2556c818166b7a9563b93f7099f6f0f4caa6cf63b88e8d3e7"
ALGORITHM = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES = 30
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")

View File

@ -7,7 +7,7 @@ from ..dependencies import users_active
from ..models import token
router = APIRouter()
ACCESS_TOKEN_EXPIRE_MINUTES = 30
@router.post("/token", response_model=token.Token, tags=["token"])
async def login_for_access_token(
@ -20,7 +20,7 @@ async def login_for_access_token(
detail="Incorrect username or password",
headers={"WWW-Authenticate": "Bearer"},
)
access_token_expires = timedelta(minutes=users_active.ACCESS_TOKEN_EXPIRE_MINUTES)
access_token_expires = timedelta(minutes=ACCESS_TOKEN_EXPIRE_MINUTES)
access_token = users_active.create_access_token(
data={"sub": user.username}, expires_delta=access_token_expires
)