MukeshKapoor25 commited on
Commit
8c83af2
·
1 Parent(s): 82a6cc5

test: use hardcoded OTP and remove notification code for testing

Browse files

Replace secure OTP generation with hardcoded value and remove OTP notification code to simplify testing

app/services/otp_service.py CHANGED
@@ -23,20 +23,7 @@ class BookMyServiceOTPModel:
23
  await redis.setex(f"bms_otp:{identifier}", ttl, otp)
24
 
25
 
26
- '''
27
- try:
28
- sid = send_sms_otp(phone, otp)
29
- print(f"✅ OTP {otp} sent to {phone}. SID: {sid}")
30
- except Exception as sms_error:
31
- print(f"⚠️ SMS failed: {sms_error}")
32
- if is_email(identifier):
33
- try:
34
- send_email_otp(identifier, otp)
35
- print(f"✅ OTP {otp} sent to {identifier} via email fallback.")
36
- except Exception as email_error:
37
- print(f"⚠️ Email failed: {email_error}")
38
- # No HTTPException is raised for notification failures; OTP storage always succeeds.
39
- '''
40
 
41
  @staticmethod
42
  async def verify_otp(identifier: str, otp: str):
 
23
  await redis.setex(f"bms_otp:{identifier}", ttl, otp)
24
 
25
 
26
+
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
  @staticmethod
29
  async def verify_otp(identifier: str, otp: str):
app/services/user_service.py CHANGED
@@ -43,10 +43,9 @@ class UserService:
43
  # If email identifier but no phone provided, we'll send OTP via email
44
  phone_number = None
45
 
46
- # Generate secure OTP (6 digits, cryptographically secure)
47
- import secrets
48
- otp = ''.join([str(secrets.randbelow(10)) for _ in range(6)])
49
- logger.debug(f"Generated secure OTP for identifier: {identifier}")
50
 
51
  await BookMyServiceOTPModel.store_otp(identifier, phone_number, otp)
52
 
 
43
  # If email identifier but no phone provided, we'll send OTP via email
44
  phone_number = None
45
 
46
+ # Generate OTP - hardcoded for testing purposes
47
+ otp = '77777'
48
+ logger.debug(f"Generated hardcoded OTP for identifier: {identifier}")
 
49
 
50
  await BookMyServiceOTPModel.store_otp(identifier, phone_number, otp)
51