added PyJWT
Taylor committed
Oct 4, 2023 at 16:48 UTC
2ce57487a3ff215d0f615969c38c4e9926d7014b
3 files changed
+12
-2
backend/app/auth/models/users.py
+1
-1
@@ -31,7 +31,7 @@ class UserInput(SQLModel):
31
32
33
class UserLogin(SQLModel):
34
- email: str
34
+ username: str
35
password: str
36
37
backend/copilot.py
+10
@@ -3,6 +3,7 @@ from fastapi.responses import JSONResponse
3
from sqlmodel import create_engine, SQLModel
4
from app.db.db_session import engine
5
import uvicorn
6
+from fastapi.middleware.cors import CORSMiddleware
7
from settings import SQLALCHEMY_DATABASE_URI
8
from app.auth.routes.auth import user_router
9
from app.connectors.routes import connector_router
@@ -35,6 +36,15 @@ from app.db.db_setup import create_tables
36
37
app = FastAPI(description="CoPilot API", version="0.1.0", title="CoPilot API")
38
39
+# Allow all origins, methods and headers
40
+app.add_middleware(
41
+ CORSMiddleware,
42
+ allow_origins=["*"],
43
+ allow_credentials=True,
44
+ allow_methods=["*"],
45
+ allow_headers=["*"],
46
+)
47
+
48
@app.exception_handler(HTTPException)
49
async def custom_http_exception_handler(request: Request, exc: HTTPException):
50
return JSONResponse(
backend/requirements.in
+1
-1
@@ -18,7 +18,7 @@ python-multipart
18
pytest
19
python-magic
20
passlib
21
-jwt
21
+PyJWT
22
pydantic[email]
23
pyvelociraptor~=0.1
24
regex