Update main.py
Browse files
main.py
CHANGED
|
@@ -3,7 +3,6 @@
|
|
| 3 |
from fastapi import FastAPI, Form, Depends, HTTPException
|
| 4 |
from fastapi.requests import Request
|
| 5 |
from fastapi.responses import HTMLResponse, RedirectResponse
|
| 6 |
-
from fastapi.security import OAuth2PasswordRequestForm
|
| 7 |
from fastapi.templating import Jinja2Templates
|
| 8 |
from sqlalchemy.orm import Session
|
| 9 |
from auth import verify_token, oauth2_scheme, auth_views, register, UserCreate, authenticate_user, get_user_by_verification_token
|
|
@@ -44,11 +43,11 @@ async def login(request: Request):
|
|
| 44 |
@app.post("/login", response_class=HTMLResponse)
|
| 45 |
async def login_post(
|
| 46 |
request: Request,
|
| 47 |
-
|
|
|
|
| 48 |
db: Session = Depends(get_db)
|
| 49 |
):
|
| 50 |
-
|
| 51 |
-
password = form_data.password
|
| 52 |
|
| 53 |
# Validate the email and password
|
| 54 |
if not email or not password:
|
|
|
|
| 3 |
from fastapi import FastAPI, Form, Depends, HTTPException
|
| 4 |
from fastapi.requests import Request
|
| 5 |
from fastapi.responses import HTMLResponse, RedirectResponse
|
|
|
|
| 6 |
from fastapi.templating import Jinja2Templates
|
| 7 |
from sqlalchemy.orm import Session
|
| 8 |
from auth import verify_token, oauth2_scheme, auth_views, register, UserCreate, authenticate_user, get_user_by_verification_token
|
|
|
|
| 43 |
@app.post("/login", response_class=HTMLResponse)
|
| 44 |
async def login_post(
|
| 45 |
request: Request,
|
| 46 |
+
email: str = Form(...),
|
| 47 |
+
password: str = Form(...),
|
| 48 |
db: Session = Depends(get_db)
|
| 49 |
):
|
| 50 |
+
|
|
|
|
| 51 |
|
| 52 |
# Validate the email and password
|
| 53 |
if not email or not password:
|