Yatharth999 commited on
Commit
c472f3e
·
verified ·
1 Parent(s): d6269ca

Update server.py

Browse files
Files changed (1) hide show
  1. server.py +5 -1
server.py CHANGED
@@ -1,4 +1,5 @@
1
  import os
 
2
  from fastapi import FastAPI, HTTPException
3
  from fastapi.responses import FileResponse
4
  from fastapi.middleware.cors import CORSMiddleware
@@ -7,6 +8,7 @@ from auth_handler import AuthManager
7
 
8
  app = FastAPI()
9
  auth = AuthManager()
 
10
 
11
  app.add_middleware(
12
  CORSMiddleware,
@@ -28,6 +30,8 @@ class SessionData(BaseModel):
28
  score: int
29
  duration: int
30
 
 
 
31
 
32
  @app.get("/")
33
  async def home():
@@ -46,7 +50,7 @@ async def signup(data: AuthData):
46
  return {"success": success, "message": msg}
47
 
48
  @app.post("/send-otp")
49
- async def send_otp(data: AuthData):
50
  # 1. Generate a random 6-digit code
51
  otp_code = str(random.randint(100000, 999999))
52
 
 
1
  import os
2
+ import random
3
  from fastapi import FastAPI, HTTPException
4
  from fastapi.responses import FileResponse
5
  from fastapi.middleware.cors import CORSMiddleware
 
8
 
9
  app = FastAPI()
10
  auth = AuthManager()
11
+ auth._init_db()
12
 
13
  app.add_middleware(
14
  CORSMiddleware,
 
30
  score: int
31
  duration: int
32
 
33
+ class EmailData(BaseModel):
34
+ email: str
35
 
36
  @app.get("/")
37
  async def home():
 
50
  return {"success": success, "message": msg}
51
 
52
  @app.post("/send-otp")
53
+ async def send_otp(data: EmailData):
54
  # 1. Generate a random 6-digit code
55
  otp_code = str(random.randint(100000, 999999))
56