Verification Link Invalid
+ ++ This email verification link is no longer valid. + It may have expired or already been used. +
+ ++ Please request a new verification email to continue + setting up your WellAI account. +
+diff --git a/server/main.py b/server/main.py index 1496999..7c79568 100644 --- a/server/main.py +++ b/server/main.py @@ -7,6 +7,7 @@ import os from fastapi import FastAPI +from fastapi.staticfiles import StaticFiles from fastapi.middleware.cors import CORSMiddleware from .routers import health_prediction, authentication, users, admin @@ -26,6 +27,11 @@ ] app = FastAPI() +app.mount( + "/static", + StaticFiles(directory="server/static"), + name="static", +) app.add_middleware( CORSMiddleware, allow_origins=ORIGINS, diff --git a/server/routers/authentication.py b/server/routers/authentication.py index ab4b529..e612e57 100644 --- a/server/routers/authentication.py +++ b/server/routers/authentication.py @@ -199,23 +199,154 @@ async def register(user_reg: UserRegistrationDetails, def _send_validation_email(user: UserAccount, token: str): - """Send an email-validation link to the newly registered user.""" + """Send a branded email-validation link to the newly registered user.""" BACKEND_URL = os.getenv( "BACKEND_URL", "https://shp-backend.onrender.com" ) validation_url = f"{BACKEND_URL}/validate-email?token={token}" - email_subject = "Validate your account" + + logo_url = f"{BACKEND_URL}/static/images/wellai-logo.png" + + email_subject = "Verify your WellAI account" + email_content = f""" -
-Please click the link below to validate your email address:
- {validation_url} + + """ + send_email( recipient=user.Email, subject=email_subject, @@ -227,10 +358,152 @@ def _send_validation_email(user: UserAccount, token: str): @router.get("/validate-email") async def validate_email_address(token: str, db_conn: Session = Depends(get_db)): """Validate a user's email address via a signed token sent by email.""" - validation_failure_exception = HTTPException( - status_code=status.HTTP_400_BAD_REQUEST, - detail="Invalid or expired validation token." - ) + def validation_error_response(): + html_content = """ + + + + + ++ This email verification link is no longer valid. + It may have expired or already been used. +
+ ++ Please request a new verification email to continue + setting up your WellAI account. +
+Your email has been successfully validated. You can now close this window and log in to your account.
+ + + + + +