Merge branch 'main' of https://github.com/dm1sh/porridger_tmp
This commit is contained in:
commit
cc414e38bd
@ -7,7 +7,7 @@ from fastapi.templating import Jinja2Templates
|
|||||||
from fastapi.requests import Request
|
from fastapi.requests import Request
|
||||||
|
|
||||||
from pydantic import json
|
from pydantic import json
|
||||||
from typing import Any, Annotated
|
from typing import Any, Annotated, List
|
||||||
from starlette.staticfiles import StaticFiles
|
from starlette.staticfiles import StaticFiles
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
@ -12,14 +12,12 @@ from sqlalchemy import select
|
|||||||
from .db import Session, database
|
from .db import Session, database
|
||||||
from . import models, schemas
|
from . import models, schemas
|
||||||
|
|
||||||
from .db import SessionLocal
|
|
||||||
|
|
||||||
|
|
||||||
SECRET_KEY = "SECRET"
|
SECRET_KEY = "SECRET"
|
||||||
ALGORITHM = "HS256"
|
ALGORITHM = "HS256"
|
||||||
ACCESS_TOKEN_EXPIRE_MINUTES = 30
|
ACCESS_TOKEN_EXPIRE_MINUTES = 30
|
||||||
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
|
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
|
||||||
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="/api/token")
|
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
|
||||||
|
|
||||||
|
|
||||||
def get_db():
|
def get_db():
|
||||||
@ -30,14 +28,6 @@ def get_db():
|
|||||||
db.close()
|
db.close()
|
||||||
|
|
||||||
|
|
||||||
def get_db():
|
|
||||||
db = SessionLocal()
|
|
||||||
try:
|
|
||||||
yield db
|
|
||||||
finally:
|
|
||||||
db.close()
|
|
||||||
|
|
||||||
|
|
||||||
def verify_password(plain_password, hashed_password):
|
def verify_password(plain_password, hashed_password):
|
||||||
return pwd_context.verify(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:
|
if current_user.disabled:
|
||||||
raise HTTPException(status_code=400, detail="Inactive user")
|
raise HTTPException(status_code=400, detail="Inactive user")
|
||||||
return current_user
|
return current_user
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
|
|
||||||
# def get_db(request: Request):
|
|
||||||
# return request.state.db
|
|
||||||
>>>>>>> 3e2555084388b8d23113ce4698714b993895142b
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user