Spaces:
Runtime error
Runtime error
Update backend/main.py
Browse files- 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 |
-
|
| 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 |
-
|
| 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)
|