diff --git a/192.168.1.151 b/192.168.1.151 new file mode 100644 index 0000000..7b8ed1e Binary files /dev/null and b/192.168.1.151 differ diff --git a/main b/main index 1a044fe..adcd807 100644 --- a/main +++ b/main @@ -178,6 +178,12 @@ def apilogin(): username = data["username"] password = data["password"] + usernames_old = ['EXAMPLE'] + + migrate = false + if username in usernames_old: + migrate = true + check_username_thing = check_username_taken(username) if check_username_thing == "error": @@ -197,9 +203,28 @@ def apilogin(): conn.commit() conn.close() - return { - "key": randomCharacters - }, 200 + if migrate = false: + return { + "key": randomCharacters + }, 200 + else: + return { + "key": randomCharacters, + "migrate": "1" + }, 200 + +@app.route("/api/supersecretapi", methods=("GET", "POST")) +def apilogin(): + if request.method == "POST": + data = request.get_json() + username = data["username"] + password = data["password"] + hashedpassword = generate_password_hash(password) + + conn = get_db_connection() + conn.execute("UPDATE users SET password = ? WHERE username = ?", (hashedpassword, username)) + conn.commit() + conn.close() @app.route("/api/userinfo", methods=("GET", "POST")) def apiuserinfo():