Migration to chacha2 start

This commit is contained in:
Tracker-Friendly 2024-02-25 17:05:55 +00:00
parent 58f9bd25ff
commit c66490bf28
2 changed files with 28 additions and 3 deletions

BIN
192.168.1.151 Normal file

Binary file not shown.

31
main
View File

@ -178,6 +178,12 @@ def apilogin():
username = data["username"] username = data["username"]
password = data["password"] password = data["password"]
usernames_old = ['EXAMPLE']
migrate = false
if username in usernames_old:
migrate = true
check_username_thing = check_username_taken(username) check_username_thing = check_username_taken(username)
if check_username_thing == "error": if check_username_thing == "error":
@ -197,9 +203,28 @@ def apilogin():
conn.commit() conn.commit()
conn.close() conn.close()
return { if migrate = false:
"key": randomCharacters return {
}, 200 "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")) @app.route("/api/userinfo", methods=("GET", "POST"))
def apiuserinfo(): def apiuserinfo():