setup profiles
parent
3d423651c0
commit
4262ec9f04
@ -0,0 +1,24 @@
|
||||
from flask import render_template, Blueprint, flash
|
||||
from flask import request, redirect, url_for, session
|
||||
from suchwow.models import Profile
|
||||
from suchwow.utils.decorators import login_required
|
||||
|
||||
|
||||
bp = Blueprint("profile", "profile")
|
||||
|
||||
@bp.route("/profile/edit", methods=["GET", "POST"])
|
||||
@login_required
|
||||
def edit():
|
||||
if request.method == "POST":
|
||||
address = request.form.get("address")
|
||||
if len(address) in [97, 108]:
|
||||
profile = Profile(
|
||||
username=session["auth"]["preferred_username"],
|
||||
address=address
|
||||
)
|
||||
profile.save()
|
||||
return redirect(request.args.get("redirect", "/"))
|
||||
else:
|
||||
flash("WTF bro, that's not a valid Wownero address")
|
||||
return redirect(request.url)
|
||||
return render_template("profile/edit.html")
|
@ -0,0 +1,20 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="container" style="width:40%;">
|
||||
<div class="edit">
|
||||
<h1>Edit Profile</h1>
|
||||
<p>You need to setup your profile before you can submit memes. As of now this only consists of a payout address so we know where to send Wownero if someone sends funds for your post.</p>
|
||||
<form method=post enctype=multipart/form-data class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label class="sr-only" for="address">Payout Address</label>
|
||||
<input type="text" class="form-control mb-2 mr-sm-2 mb-sm-0" id="address" placeholder="Wownero address for payouts" name="address">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-success">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue