Added log for add user
This commit is contained in:
parent
df320bea8b
commit
3dcc985087
1 changed files with 6 additions and 3 deletions
9
main.py
9
main.py
|
@ -123,12 +123,15 @@ def remove_user():
|
||||||
|
|
||||||
@app.route("/adduser/user", methods=['GET'])
|
@app.route("/adduser/user", methods=['GET'])
|
||||||
def adduser():
|
def adduser():
|
||||||
user = request.args.get("username")
|
username = request.args.get("username")
|
||||||
c.execute("SELECT * FROM users WHERE username=?", [user])
|
c.execute("SELECT * FROM users WHERE username=?", [username])
|
||||||
if c.fetchall() == []:
|
if c.fetchall() == []:
|
||||||
c.execute("INSERT or IGNORE INTO users (username, balance) VALUES (?, 0)", [user])
|
c.execute("INSERT or IGNORE INTO users (username, balance) VALUES (?, 0)", [username])
|
||||||
conn.commit()
|
conn.commit()
|
||||||
socketio.emit("update", "update")
|
socketio.emit("update", "update")
|
||||||
|
c.execute(f"SELECT * FROM users WHERE username={username}")
|
||||||
|
user = c.fetchall()[0]
|
||||||
|
db_log(f"Added user id: {user[0]} name: {user[2]}")
|
||||||
return 'Added user <a href="/list">user and tag list</a>'
|
return 'Added user <a href="/list">user and tag list</a>'
|
||||||
else:
|
else:
|
||||||
return '<p>Error: 170</p> <a href="/list">user and tag list</a>'
|
return '<p>Error: 170</p> <a href="/list">user and tag list</a>'
|
||||||
|
|
Loading…
Reference in a new issue