user can buy 1-year coupon
This commit is contained in:
parent
2d9f8e83e6
commit
55ae61527d
|
@ -4,7 +4,7 @@ from flask_login import login_required, current_user
|
||||||
from flask_wtf import FlaskForm
|
from flask_wtf import FlaskForm
|
||||||
from wtforms import StringField, validators
|
from wtforms import StringField, validators
|
||||||
|
|
||||||
from app.config import ADMIN_EMAIL
|
from app.config import ADMIN_EMAIL, PADDLE_VENDOR_ID, PADDLE_COUPON_ID
|
||||||
from app.dashboard.base import dashboard_bp
|
from app.dashboard.base import dashboard_bp
|
||||||
from app.db import Session
|
from app.db import Session
|
||||||
from app.email_utils import send_email
|
from app.email_utils import send_email
|
||||||
|
@ -55,10 +55,6 @@ def coupon_route():
|
||||||
if coinbase_subscription and coinbase_subscription.is_active():
|
if coinbase_subscription and coinbase_subscription.is_active():
|
||||||
can_use_coupon = False
|
can_use_coupon = False
|
||||||
|
|
||||||
if not can_use_coupon:
|
|
||||||
flash("You already have another subscription.", "warning")
|
|
||||||
return redirect(url_for("dashboard.index"))
|
|
||||||
|
|
||||||
if coupon_form.validate_on_submit():
|
if coupon_form.validate_on_submit():
|
||||||
code = coupon_form.code.data
|
code = coupon_form.code.data
|
||||||
|
|
||||||
|
@ -112,4 +108,10 @@ def coupon_route():
|
||||||
else:
|
else:
|
||||||
flash(f"Code *{code}* expired or invalid", "warning")
|
flash(f"Code *{code}* expired or invalid", "warning")
|
||||||
|
|
||||||
return render_template("dashboard/coupon.html", coupon_form=coupon_form)
|
return render_template(
|
||||||
|
"dashboard/coupon.html",
|
||||||
|
coupon_form=coupon_form,
|
||||||
|
PADDLE_VENDOR_ID=PADDLE_VENDOR_ID,
|
||||||
|
PADDLE_COUPON_ID=PADDLE_COUPON_ID,
|
||||||
|
can_use_coupon=can_use_coupon,
|
||||||
|
)
|
||||||
|
|
|
@ -2,11 +2,29 @@
|
||||||
|
|
||||||
{% set active_page = "dashboard" %}
|
{% set active_page = "dashboard" %}
|
||||||
|
|
||||||
|
{% block head %}
|
||||||
|
<script src="https://cdn.paddle.com/paddle/paddle.js"></script>
|
||||||
|
<script>
|
||||||
|
if (window.Paddle === undefined) {
|
||||||
|
console.log("cannot load Paddle from CDN");
|
||||||
|
document.write('<script src="/static/vendor/paddle.js"><\/script>')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
html.mvc__a.mvc__lot.mvc__of.mvc__classes.mvc__to.mvc__increase.mvc__the.mvc__odds.mvc__of.mvc__winning.mvc__specificity, html.mvc__a.mvc__lot.mvc__of.mvc__classes.mvc__to.mvc__increase.mvc__the.mvc__odds.mvc__of.mvc__winning.mvc__specificity > body {
|
||||||
|
position: static;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
Coupon
|
Coupon
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block default_content %}
|
{% block default_content %}
|
||||||
|
{% if can_use_coupon %}
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h1 class="h2">Coupon</h1>
|
<h1 class="h2">Coupon</h1>
|
||||||
|
@ -24,5 +42,26 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<h2>1-year coupon</h2>
|
||||||
|
<div class="mb-3">
|
||||||
|
You can buy a 1-year coupon that allows anyone to have the SimpleLogin premium for 1 year.
|
||||||
|
Can be an idea for a gift card :).
|
||||||
|
After the payment, the coupon will be sent to you by email.
|
||||||
|
</div>
|
||||||
|
<a href="#!" class="paddle_button btn btn-primary" data-product="{{ PADDLE_COUPON_ID }}">Buy 1-year SimpleLogin
|
||||||
|
coupon</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block script %}
|
||||||
|
<script type="text/javascript">
|
||||||
|
Paddle.Setup({vendor: {{PADDLE_VENDOR_ID}}});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
Loading…
Reference in a new issue