You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
829 B

4 years ago
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")