July 3rd - Update landing page
This commit is contained in:
+20
-3
@@ -27,16 +27,28 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def _send_welcome_email(to_email, login_url, tenant_name, plan_code, trial_ends_at):
|
||||
"""Fire a welcome email in a background thread — never blocks the request."""
|
||||
"""Fire a welcome email in a background thread — never blocks the request.
|
||||
|
||||
The wording adapts to the plan: the Free plan has no trial/expiry, paid
|
||||
plans start a 14-day trial. `trial_note` carries the plan-appropriate line
|
||||
and `trial_ends_at` is blank for Free so the template hides the trial row.
|
||||
"""
|
||||
try:
|
||||
from app.billing.emails import send_billing_email
|
||||
is_free = (plan_code == 'free')
|
||||
ends_str = (trial_ends_at.strftime('%B %d, %Y')
|
||||
if hasattr(trial_ends_at, 'strftime') else str(trial_ends_at or ''))
|
||||
if is_free:
|
||||
trial_note = "You're on the Free plan — no credit card, no expiry."
|
||||
ends_str = ''
|
||||
else:
|
||||
trial_note = f'Your 14-day free trial runs through {ends_str}.'
|
||||
send_billing_email(to_email, 'welcome', {
|
||||
'tenant_name': tenant_name,
|
||||
'login_url': login_url,
|
||||
'trial_days': 14,
|
||||
'trial_days': 0 if is_free else 14,
|
||||
'trial_ends_at': ends_str,
|
||||
'trial_note': trial_note,
|
||||
'plan_name': plan_code.title(),
|
||||
})
|
||||
except Exception as exc:
|
||||
@@ -115,6 +127,11 @@ def index():
|
||||
plan_code = form.plan.data
|
||||
password = form.password.data
|
||||
|
||||
# Free plan is free forever — no trial, no expiry. Paid plans start a
|
||||
# 14-day trial. trial_days=0 makes create_tenant provision the tenant as
|
||||
# 'active' (see control/provision.py) so the billing gate never blocks it.
|
||||
trial_days = 0 if plan_code == 'free' else 14
|
||||
|
||||
try:
|
||||
from control.provision import create_tenant
|
||||
info = create_tenant(
|
||||
@@ -124,7 +141,7 @@ def index():
|
||||
admin_email=email,
|
||||
admin_full_name=full_name,
|
||||
admin_password=password,
|
||||
trial_days=14,
|
||||
trial_days=trial_days,
|
||||
)
|
||||
except ValueError as exc:
|
||||
flash(str(exc), 'danger')
|
||||
|
||||
Reference in New Issue
Block a user