Mobii23 commited on
Commit
cb370ff
·
verified ·
1 Parent(s): 208470f

Update backend/main.py

Browse files
Files changed (1) hide show
  1. backend/main.py +2 -8
backend/main.py CHANGED
@@ -462,19 +462,13 @@ async def register(user: schemas.UserCreate, db: Session = Depends(database.get_
462
  existing_user.otp_code = otp
463
  existing_user.otp_expiry = datetime.utcnow() + timedelta(minutes=10)
464
  db.commit()
465
- try:
466
- await email_utils.send_alert_email(user.email, "DocuSort Verification", f"Your verification code is: <br><br><b style='font-size:24px;'>{otp}</b><br><br>This code expires in 10 minutes.")
467
- except Exception as e:
468
- print(f"Warning: Email blocked by cloud provider network rules: {e}")
469
  return {"message": "OTP resent"}
470
 
471
  new_user = models.User(email=user.email, hashed_password=auth.Hash.bcrypt(user.password), is_active=False, otp_code=otp, otp_expiry=datetime.utcnow()+timedelta(minutes=10))
472
  db.add(new_user)
473
  db.commit()
474
- try:
475
- await email_utils.send_alert_email(user.email, "DocuSort Verification", f"Your verification code is: <br><br><b style='font-size:24px;'>{otp}</b><br><br>This code expires in 10 minutes.")
476
- except Exception as e:
477
- print(f"Warning: Email blocked by cloud provider network rules: {e}")
478
  return {"message": "Registered"}
479
 
480
  @app.post("/auth/verify-registration", response_model=schemas.Token)
 
462
  existing_user.otp_code = otp
463
  existing_user.otp_expiry = datetime.utcnow() + timedelta(minutes=10)
464
  db.commit()
465
+ await email_utils.send_alert_email(user.email, "DocuSort Verification", f"Your verification code is: <br><br><b style='font-size:24px;'>{otp}</b><br><br>This code expires in 10 minutes.")
 
 
 
466
  return {"message": "OTP resent"}
467
 
468
  new_user = models.User(email=user.email, hashed_password=auth.Hash.bcrypt(user.password), is_active=False, otp_code=otp, otp_expiry=datetime.utcnow()+timedelta(minutes=10))
469
  db.add(new_user)
470
  db.commit()
471
+ await email_utils.send_alert_email(user.email, "DocuSort Verification", f"Your verification code is: <br><br><b style='font-size:24px;'>{otp}</b><br><br>This code expires in 10 minutes.")
 
 
 
472
  return {"message": "Registered"}
473
 
474
  @app.post("/auth/verify-registration", response_model=schemas.Token)