diff --git a/app/dashboard/views/coupon.py b/app/dashboard/views/coupon.py index 8c386034..0b1cd56a 100644 --- a/app/dashboard/views/coupon.py +++ b/app/dashboard/views/coupon.py @@ -4,7 +4,7 @@ from flask_login import login_required, current_user from flask_wtf import FlaskForm 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.db import Session from app.email_utils import send_email @@ -55,10 +55,6 @@ def coupon_route(): if coinbase_subscription and coinbase_subscription.is_active(): 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(): code = coupon_form.code.data @@ -112,4 +108,10 @@ def coupon_route(): else: 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, + ) diff --git a/templates/dashboard/coupon.html b/templates/dashboard/coupon.html index 54779ff9..7c011b29 100644 --- a/templates/dashboard/coupon.html +++ b/templates/dashboard/coupon.html @@ -2,27 +2,66 @@ {% set active_page = "dashboard" %} +{% block head %} + + + + + +{% endblock %} + {% block title %} Coupon {% endblock %} {% block default_content %} + {% if can_use_coupon %} +
+
+

Coupon

+ +
+ Please enter the coupon here to upgrade your account or extend your current subscription. +
+ +
+ {{ coupon_form.csrf_token }} + + {{ coupon_form.code(class="form-control", placeholder="Licence Code") }} + {{ render_field_errors(coupon_form.code) }} + +
+
+
+ {% endif %} +
-

Coupon

- -
- Please enter the coupon here to upgrade your account or extend your current subscription. +

1-year coupon

+
+ 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.
- -
- {{ coupon_form.csrf_token }} - - {{ coupon_form.code(class="form-control", placeholder="Licence Code") }} - {{ render_field_errors(coupon_form.code) }} - -
+ Buy 1-year SimpleLogin + coupon
+ +{% endblock %} + +{% block script %} + {% endblock %} \ No newline at end of file