allow user having apple subscription to switch to web subscription
This commit is contained in:
parent
51a7dbfa52
commit
408322217d
|
@ -49,8 +49,15 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% elif apple_sub and apple_sub.is_valid() %}
|
{% elif apple_sub and apple_sub.is_valid() %}
|
||||||
You are on the Premium plan which expires {{ apple_sub.expires_date | dt }}
|
You are on the Premium plan (subscribed via Apple) which expires {{ apple_sub.expires_date | dt }}
|
||||||
({{ apple_sub.expires_date.format("YYYY-MM-DD") }}).
|
({{ apple_sub.expires_date.format("YYYY-MM-DD") }}).
|
||||||
|
<div class="alert alert-info">
|
||||||
|
If you want to subscribe via the Web instead, please make sure to cancel your subscription
|
||||||
|
on Apple first.
|
||||||
|
<a href="{{ url_for('dashboard.pricing') }}"
|
||||||
|
class="">Upgrade <i class="fa fa-arrow-right" aria-hidden="true"></i></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% elif coinbase_sub and coinbase_sub.is_active() %}
|
{% elif coinbase_sub and coinbase_sub.is_active() %}
|
||||||
You are on the Premium plan which expires {{ coinbase_sub.end_at | dt }}
|
You are on the Premium plan which expires {{ coinbase_sub.end_at | dt }}
|
||||||
({{ coinbase_sub.end_at.format("YYYY-MM-DD") }}).
|
({{ coinbase_sub.end_at.format("YYYY-MM-DD") }}).
|
||||||
|
@ -343,8 +350,9 @@
|
||||||
<input type="hidden" name="form-name" value="sender-in-ra">
|
<input type="hidden" name="form-name" value="sender-in-ra">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input type="checkbox" id="include-sender-ra" name="enable"
|
<input type="checkbox" id="include-sender-ra" name="enable"
|
||||||
{# todo: remove current_user.include_sender_in_reverse_alias is none condition #}
|
{# todo: remove current_user.include_sender_in_reverse_alias is none condition #}
|
||||||
{% if current_user.include_sender_in_reverse_alias is none or current_user.include_sender_in_reverse_alias %} checked {% endif %} class="form-check-input">
|
{% if current_user.include_sender_in_reverse_alias is none or current_user.include_sender_in_reverse_alias %}
|
||||||
|
checked {% endif %} class="form-check-input">
|
||||||
<label for="include-sender-ra">Include sender address in reverse-alias</label>
|
<label for="include-sender-ra">Include sender address in reverse-alias</label>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-outline-primary">Update</button>
|
<button type="submit" class="btn btn-outline-primary">Update</button>
|
||||||
|
|
|
@ -12,6 +12,7 @@ from app.config import (
|
||||||
)
|
)
|
||||||
from app.dashboard.base import dashboard_bp
|
from app.dashboard.base import dashboard_bp
|
||||||
from app.log import LOG
|
from app.log import LOG
|
||||||
|
from app.models import AppleSubscription
|
||||||
|
|
||||||
|
|
||||||
@dashboard_bp.route("/pricing", methods=["GET", "POST"])
|
@dashboard_bp.route("/pricing", methods=["GET", "POST"])
|
||||||
|
@ -21,6 +22,10 @@ def pricing():
|
||||||
flash("You are already a premium user", "warning")
|
flash("You are already a premium user", "warning")
|
||||||
return redirect(url_for("dashboard.index"))
|
return redirect(url_for("dashboard.index"))
|
||||||
|
|
||||||
|
apple_sub: AppleSubscription = AppleSubscription.get_by(user_id=current_user.id)
|
||||||
|
if apple_sub and apple_sub.is_valid():
|
||||||
|
flash("Please make sure to cancel your subscription on Apple first", "warning")
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"dashboard/pricing.html",
|
"dashboard/pricing.html",
|
||||||
PADDLE_VENDOR_ID=PADDLE_VENDOR_ID,
|
PADDLE_VENDOR_ID=PADDLE_VENDOR_ID,
|
||||||
|
|
|
@ -477,10 +477,6 @@ class User(db.Model, ModelMixin, UserMixin, PasswordOracle):
|
||||||
if sub and not sub.cancelled:
|
if sub and not sub.cancelled:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
apple_sub: AppleSubscription = AppleSubscription.get_by(user_id=self.id)
|
|
||||||
if apple_sub and apple_sub.is_valid():
|
|
||||||
return False
|
|
||||||
|
|
||||||
manual_sub: ManualSubscription = ManualSubscription.get_by(user_id=self.id)
|
manual_sub: ManualSubscription = ManualSubscription.get_by(user_id=self.id)
|
||||||
# user who has giveaway premium can decide to upgrade
|
# user who has giveaway premium can decide to upgrade
|
||||||
if manual_sub and manual_sub.is_active() and not manual_sub.is_giveaway:
|
if manual_sub and manual_sub.is_active() and not manual_sub.is_giveaway:
|
||||||
|
|
Loading…
Reference in a new issue