forked from Ailur/burgernotes-server
Migration to chacha2 start
This commit is contained in:
parent
58f9bd25ff
commit
c66490bf28
Binary file not shown.
25
main
25
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()
|
||||
|
||||
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():
|
||||
|
|
Loading…
Reference in New Issue