This commit is contained in:
DmitryGantimurov 2023-08-02 00:58:25 +03:00
commit cc414e38bd
2 changed files with 2 additions and 19 deletions

View File

@ -7,7 +7,7 @@ from fastapi.templating import Jinja2Templates
from fastapi.requests import Request
from pydantic import json
from typing import Any, Annotated
from typing import Any, Annotated, List
from starlette.staticfiles import StaticFiles
import requests

View File

@ -12,14 +12,12 @@ from sqlalchemy import select
from .db import Session, database
from . import models, schemas
from .db import SessionLocal
SECRET_KEY = "SECRET"
ALGORITHM = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES = 30
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="/api/token")
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
def get_db():
@ -30,14 +28,6 @@ def get_db():
db.close()
def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close()
def verify_password(plain_password, hashed_password):
return pwd_context.verify(plain_password, hashed_password)
@ -100,10 +90,3 @@ async def get_current_active_user(
if current_user.disabled:
raise HTTPException(status_code=400, detail="Inactive user")
return current_user
<<<<<<< HEAD
=======
# def get_db(request: Request):
# return request.state.db
>>>>>>> 3e2555084388b8d23113ce4698714b993895142b