EduConnect / app /api /login.py
dtyago's picture
restructure project
7832703
raw
history blame
951 Bytes
# # 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"}