diff --git a/app/routes.py b/app/routes.py index eeed3d8..c1667ee 100644 --- a/app/routes.py +++ b/app/routes.py @@ -9,7 +9,7 @@ router = APIRouter() @router.post("/register") -async def create_user(request: UserCreate, db: Session = Depends(get_db)): +def create_user(request: UserCreate, db: Session = Depends(get_db)): insert_data(model="Users", data=request, db=db) send_otp(receiver=request.mobile) return {"message": "User created, pending OTP verification"} diff --git a/app/twilio.py b/app/twilio.py index 02d26c7..3ef20f6 100644 --- a/app/twilio.py +++ b/app/twilio.py @@ -4,20 +4,20 @@ from constants import ACCOUNT_ID, TOKEN, SMS_SENDER from database.crud import save_otp -async def connect_api(): +def connect_api(): account_sid = ACCOUNT_ID auth_token = TOKEN client = Client(account_sid, auth_token) return client -async def generate_code(): +def generate_code(): bits = 16 code = randbits(bits) return code -async def send_otp(receiver): +def send_otp(receiver): client = connect_api() code = generate_code() message = "Your OTP code is {0}".format(code)