diff --git a/xmrbackers/forms.py b/xmrbackers/forms.py index cf300fe..7db15cb 100644 --- a/xmrbackers/forms.py +++ b/xmrbackers/forms.py @@ -7,3 +7,8 @@ from wtforms.validators import DataRequired class UserAuth(FlaskForm): username = StringField('Username:', validators=[DataRequired()], render_kw={"placeholder": "Username", "class": "form-control", "type": "text"}) password = StringField('Password:', validators=[DataRequired()], render_kw={"placeholder": "Password", "class": "form-control", "type": "password"}) + +class ConfirmSubscription(FlaskForm): + tx_id = StringField('TX ID:', validators=[DataRequired()], render_kw={"placeholder": "TX ID", "class": "form-control", "type": "text"}) + tx_key = StringField('TX Key:', validators=[DataRequired()], render_kw={"placeholder": "TX Key", "class": "form-control", "type": "text"}) + wallet_address = StringField('XMR Address:', validators=[DataRequired()], render_kw={"placeholder": "XMR Address", "class": "form-control", "type": "text"}) diff --git a/xmrbackers/routes/creator.py b/xmrbackers/routes/creator.py index f77c938..a40365d 100644 --- a/xmrbackers/routes/creator.py +++ b/xmrbackers/routes/creator.py @@ -1,5 +1,6 @@ from quart import Blueprint, render_template, flash, redirect, url_for +from xmrbackers.forms import ConfirmSubscription from xmrbackers.models import User, CreatorProfile, TextPost, SubscriptionMeta @@ -42,10 +43,22 @@ async def subscription(username): subscription_meta = SubscriptionMeta.select().where( SubscriptionMeta.creator == creator ).order_by(SubscriptionMeta.create_date.desc()).first() + form = ConfirmSubscription() return await render_template( 'creator/subscription.html', - subscription_meta=subscription_meta + subscription_meta=subscription_meta, + form=form ) else: await flash('That creator does not exist.') return redirect(url_for('meta.index')) + +@bp.route('/subscription//confirm', methods=['POST']) +async def confirm_subscription(creator_id): + form = ConfirmSubscription() + if form.validate_on_submit(): + + return redirect(url_for('meta.index')) + else: + await flash('Unable to accept form POST.') + return redirect(url_for('meta.index')) diff --git a/xmrbackers/templates/creator/subscription.html b/xmrbackers/templates/creator/subscription.html index a846fe5..c426d01 100644 --- a/xmrbackers/templates/creator/subscription.html +++ b/xmrbackers/templates/creator/subscription.html @@ -15,6 +15,24 @@

XMR: {{ subscription_meta.atomic_xmr | from_atomic }}

Address: {{ subscription_meta.wallet_address }}

Hours: {{ subscription_meta.number_hours }}

+
+ {% for f in form %} + {% if f.name == 'csrf_token' %} + {{ f }} + {% else %} +
+ {{ f.label }} + {{ f }} +
+ {% endif %} + {% endfor %} + + +
{% endif %} {% include 'includes/footer.html' %}