fix(tenancy): use correct base URL for invitation link in dev vs prod
Some checks failed
Some checks failed
Dev (debug=True): http://localhost:8000/store/{store_code}/invitation/... Prod: https://{subdomain}.{main_domain}/invitation/... Previously used main_domain directly which pointed to the prod domain even in dev environments. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -983,10 +983,18 @@ class StoreTeamService:
|
||||
from app.core.config import settings as app_settings
|
||||
from app.modules.messaging.services.email_service import EmailService
|
||||
|
||||
domain = app_settings.main_domain.rstrip("/")
|
||||
scheme = "http" if "localhost" in domain else "https"
|
||||
base_url = f"{scheme}://{domain}" if "://" not in domain else domain
|
||||
acceptance_link = f"{base_url}/store/invitation/accept?token={token}"
|
||||
# Build acceptance URL using store's subdomain or main domain
|
||||
store_subdomain = store.subdomain
|
||||
main_domain = app_settings.main_domain.rstrip("/")
|
||||
|
||||
if app_settings.debug or "localhost" in main_domain:
|
||||
# Dev: use localhost with store path
|
||||
base_url = f"http://localhost:8000/store/{store.store_code}"
|
||||
else:
|
||||
# Prod: use store subdomain
|
||||
base_url = f"https://{store_subdomain}.{main_domain}"
|
||||
|
||||
acceptance_link = f"{base_url}/invitation/accept?token={token}"
|
||||
|
||||
email_service = EmailService(db)
|
||||
email_service.send_template(
|
||||
|
||||
Reference in New Issue
Block a user