send email to ask for user feedback when user cancels
This commit is contained in:
parent
c625a178e8
commit
7cc90ad194
15
server.py
15
server.py
|
@ -54,7 +54,7 @@ from app.config import (
|
||||||
from app.dashboard.base import dashboard_bp
|
from app.dashboard.base import dashboard_bp
|
||||||
from app.developer.base import developer_bp
|
from app.developer.base import developer_bp
|
||||||
from app.discover.base import discover_bp
|
from app.discover.base import discover_bp
|
||||||
from app.email_utils import send_email
|
from app.email_utils import send_email, render
|
||||||
from app.extensions import db, login_manager, migrate, limiter
|
from app.extensions import db, login_manager, migrate, limiter
|
||||||
from app.jose_utils import get_jwk_key
|
from app.jose_utils import get_jwk_key
|
||||||
from app.log import LOG
|
from app.log import LOG
|
||||||
|
@ -571,11 +571,18 @@ def setup_paddle_callback(app: Flask):
|
||||||
sub.cancelled = True
|
sub.cancelled = True
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
user = sub.user
|
||||||
|
|
||||||
send_email(
|
send_email(
|
||||||
ADMIN_EMAIL,
|
user.email,
|
||||||
subject=f"{sub.user} cancels",
|
f"SimpleLogin - what can we do to improve the product?",
|
||||||
plaintext=f"{sub} {request.form.get('cancellation_effective_date')}",
|
render(
|
||||||
|
"transactional/subscription-cancel.txt",
|
||||||
|
name=user.name or "",
|
||||||
|
end_date=request.form.get("cancellation_effective_date"),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return "No such subscription", 400
|
return "No such subscription", 400
|
||||||
elif request.form.get("alert_name") == "subscription_updated":
|
elif request.form.get("alert_name") == "subscription_updated":
|
||||||
|
|
Loading…
Reference in a new issue