Beispiel #1
0
def admin_users_add():
    username = request.form["username"]
    password = request.form["password"]
    level = int(request.form["level"])

    if "../" in username:
        return json_result(0, "invalid username")

    result = user_api.find_by_name(username)
    if result != None:
        return json_result(-1, "exist user")

    u_uuid = user_api.add(username, password, level)

    return json_result(0, u_uuid)
Beispiel #2
0
def signup():
    if request.method == "GET":
        return render_template("user/signup.html")

    username = request.form["username"]
    password = request.form["password"]

    if "../" in username:
        return render_template("user/signup.html")

    result = userAPI.find_by_name(username)
    if result != None:
        return "exist user"

    u_uuid = userAPI.add(username, password, 0)

    session["username"] = username
    session["uuid"] = str(u_uuid)
    session["level"] = 0

    return redirect("/docker")