move variable
This commit is contained in:
parent
86eb1dd4e5
commit
045f52eeef
@ -21,7 +21,7 @@ fake_users = [
|
|||||||
|
|
||||||
SECRET_KEY = "09d25e094faa6ca2556c818166b7a9563b93f7099f6f0f4caa6cf63b88e8d3e7"
|
SECRET_KEY = "09d25e094faa6ca2556c818166b7a9563b93f7099f6f0f4caa6cf63b88e8d3e7"
|
||||||
ALGORITHM = "HS256"
|
ALGORITHM = "HS256"
|
||||||
ACCESS_TOKEN_EXPIRE_MINUTES = 30
|
|
||||||
|
|
||||||
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
|
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ from ..dependencies import users_active
|
|||||||
from ..models import token
|
from ..models import token
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
ACCESS_TOKEN_EXPIRE_MINUTES = 30
|
||||||
|
|
||||||
@router.post("/token", response_model=token.Token, tags=["token"])
|
@router.post("/token", response_model=token.Token, tags=["token"])
|
||||||
async def login_for_access_token(
|
async def login_for_access_token(
|
||||||
@ -20,7 +20,7 @@ async def login_for_access_token(
|
|||||||
detail="Incorrect username or password",
|
detail="Incorrect username or password",
|
||||||
headers={"WWW-Authenticate": "Bearer"},
|
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(
|
access_token = users_active.create_access_token(
|
||||||
data={"sub": user.username}, expires_delta=access_token_expires
|
data={"sub": user.username}, expires_delta=access_token_expires
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user