File size: 951 Bytes
7832703
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# # app/api/login.py
# from fastapi import APIRouter, HTTPException, Depends, File, UploadFile
# from ..utils.authentication import verify_user
# from ..schemas import LoginSchema
# from ..crud import get_user_by_email, create_access_token

# router = APIRouter()

# @router.post("/login/")
# async def login(user_image: UploadFile = File(...)):
#     # Use MTCNN and Facenet to embed the image and verify user
#     user_verified, user_email = verify_user(user_image.file)
#     if not user_verified:
#         raise HTTPException(status_code=400, detail="Authentication Failed")

#     # Query ChromaDB for similarity and retrieve user details
#     user = get_user_by_email(user_email)
#     if not user:
#         raise HTTPException(status_code=404, detail="User not found")

#     # Generate JWT session token
#     access_token = create_access_token(data={"sub": user.email})
#     return {"access_token": access_token, "token_type": "bearer"}