forked from Ailur/burgernotes-server
Migration to chacha2 start
This commit is contained in:
parent
58f9bd25ff
commit
f4a7586771
25
main
25
main
|
@ -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()
|
||||||
|
|
||||||
|
if migrate = false:
|
||||||
return {
|
return {
|
||||||
"key": randomCharacters
|
"key": randomCharacters
|
||||||
}, 200
|
}, 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():
|
||||||
|
|
Loading…
Reference in New Issue