import flask import User import database page = flask.Blueprint("register", __name__, template_folder="templates") @page.route("/register", methods = ['POST', 'GET']) def show(): if (flask.request.method == 'GET'): return (flask.render_template("register/register.html", error = None)) email = flask.request.form.get("email"); password = flask.request.form.get("password"); first_name = flask.request.form.get("firstname"); last_name = flask.request.form.get("lastname"); username = flask.request.form.get("pseudo"); if (email == None or password == None or first_name == None or last_name == None or username == None): return (flask.render_template("register/register.html", error = "internal error")) user = User.User(first_name, last_name, username, password, email, {}); error = database.database.add_user(user) if (error != None): return (flask.render_template("register/register.html", error = error)) return (flask.redirect("/panel"))