Implement login with secure password rehashing

This commit is contained in:
2020-10-05 15:35:13 +02:00
parent f37b7392e2
commit 3bb09dbaea
4 changed files with 69 additions and 23 deletions

View File

@@ -1,13 +1,13 @@
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.routes import router
from constants import origins
from constants import ORIGINS
app = FastAPI()
app.include_router(router)
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_origins=ORIGINS,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],

View File

@@ -15,12 +15,10 @@ def add_user(data: UserCreate, db: Session = Depends(get_db)):
return user
# TODO Use OAuth2 for verification
@router.post("/login", response_model=UserLoginResponse)
def log_in(
data: UserLogin, db: Session = Depends(get_db), token: str = Depends(oauth2_scheme),
):
pass
def login(data: UserLogin, db: Session = Depends(get_db)):
response = authenticate_user(data=data, db=db)
return response
@router.post("/otpVerification", response_model=OTPVerifyResponse)