randydev commited on
Commit
091bd95
1 Parent(s): 1fcb476

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +6 -7
main.py CHANGED
@@ -255,13 +255,12 @@ def new_verify_otp(
255
  }
256
  collection.update_one({"user_id": user_id}, {"$set": update_doc}, upsert=True)
257
 
258
- def get_verify_otp(user_id):
 
259
  user = collection.find_one({"user_id": user_id})
260
- if user:
261
- otp_code = user.get("otp_code")
262
- return otp_code
263
- else:
264
- return None
265
 
266
  def generate_otp(length=6):
267
  """Generate a random OTP"""
@@ -275,7 +274,7 @@ class OTPCallbackPayload(BaseModel):
275
  @app.get("/api/get-verify", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
276
  def get_verify_otp(user_id: int):
277
  try:
278
- get_otp_code = get_verify_otp(user_id)
279
  if get_otp_code:
280
  return SuccessResponse(
281
  status="True",
 
255
  }
256
  collection.update_one({"user_id": user_id}, {"$set": update_doc}, upsert=True)
257
 
258
+
259
+ def get_stored_otp(user_id: int):
260
  user = collection.find_one({"user_id": user_id})
261
+ if user and "otp_code" in user:
262
+ return user["otp_code"]
263
+ return None
 
 
264
 
265
  def generate_otp(length=6):
266
  """Generate a random OTP"""
 
274
  @app.get("/api/get-verify", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
275
  def get_verify_otp(user_id: int):
276
  try:
277
+ get_otp_code = get_stored_otp(user_id)
278
  if get_otp_code:
279
  return SuccessResponse(
280
  status="True",