forked from bton/matekasse
error.html template
This commit is contained in:
parent
9a7b4ca5a7
commit
ad786ddff2
2 changed files with 12 additions and 9 deletions
|
@ -86,6 +86,7 @@ def create_app(test_config=None):
|
||||||
window.location="http://matekasse.server.c3h/list"
|
window.location="http://matekasse.server.c3h/list"
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
<title>Strichliste</title>
|
||||||
<p><a href="/list">user and tag list</a> | <a href="/documentation">Documentation</a></p>
|
<p><a href="/list">user and tag list</a> | <a href="/documentation">Documentation</a></p>
|
||||||
<p>1 Credit = 1,50 Euro</p>
|
<p>1 Credit = 1,50 Euro</p>
|
||||||
<form action="/list/user" method="get"> Search for User: <input name="user"><input type="submit"></form>
|
<form action="/list/user" method="get"> Search for User: <input name="user"><input type="submit"></form>
|
||||||
|
@ -114,6 +115,7 @@ def create_app(test_config=None):
|
||||||
var socket = io();
|
var socket = io();
|
||||||
""" + 'socket.on("update", function(){ window.location="http://matekasse.server.c3h/list/user?id=' + id + '"});' + f"""
|
""" + 'socket.on("update", function(){ window.location="http://matekasse.server.c3h/list/user?id=' + id + '"});' + f"""
|
||||||
</script>
|
</script>
|
||||||
|
<title>{escape(user[1])}</title>
|
||||||
<p><a href="/list">user and tag list</a> | <a href="/documentation">Documentation</a></p>
|
<p><a href="/list">user and tag list</a> | <a href="/documentation">Documentation</a></p>
|
||||||
<p> {escape(user[1])} : {user[2]} <p>
|
<p> {escape(user[1])} : {user[2]} <p>
|
||||||
<form action="/addtag" method="get"><input name="id" type="hidden" value="{user[0]}"><button type="submit">Add Tag</button></form>
|
<form action="/addtag" method="get"><input name="id" type="hidden" value="{user[0]}"><button type="submit">Add Tag</button></form>
|
||||||
|
@ -128,7 +130,7 @@ def create_app(test_config=None):
|
||||||
</html>
|
</html>
|
||||||
"""
|
"""
|
||||||
else:
|
else:
|
||||||
return "Error: 043"
|
return render_template("error.html", error_code="043")
|
||||||
|
|
||||||
@app.route("/adduser")
|
@app.route("/adduser")
|
||||||
def new_user():
|
def new_user():
|
||||||
|
@ -149,9 +151,9 @@ def create_app(test_config=None):
|
||||||
app.logger.info(f"Deleted user ?", [user_id])
|
app.logger.info(f"Deleted user ?", [user_id])
|
||||||
db.commit()
|
db.commit()
|
||||||
socketio.emit("update", "update")
|
socketio.emit("update", "update")
|
||||||
return f'<p><p><a href="/list">user and tag list</a> | <a href="/documentation">Documentation</a></p> <p>Deleted user {escape(user_name)}</p><a href="/list">return to the tags and user list</a></p>'
|
return f'<title>remove user</title><p><p><a href="/list">user and tag list</a> | <a href="/documentation">Documentation</a></p> <p>Deleted user {escape(user_name)}</p><a href="/list">return to the tags and user list</a></p>'
|
||||||
else:
|
else:
|
||||||
return "Error: 043"
|
return render_template("error.html", error_code="043")
|
||||||
|
|
||||||
@app.route("/adduser/user", methods=['GET'])
|
@app.route("/adduser/user", methods=['GET'])
|
||||||
def adduser():
|
def adduser():
|
||||||
|
@ -159,7 +161,7 @@ def create_app(test_config=None):
|
||||||
c = db.cursor()
|
c = db.cursor()
|
||||||
username = request.args.get("username")
|
username = request.args.get("username")
|
||||||
if username == None:
|
if username == None:
|
||||||
return "418"
|
return render_template("error.html", error_code="418")
|
||||||
c.execute("SELECT * FROM users WHERE username=?", [username])
|
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)", [username])
|
c.execute("INSERT or IGNORE INTO users (username, balance) VALUES (?, 0)", [username])
|
||||||
|
@ -177,7 +179,7 @@ def create_app(test_config=None):
|
||||||
</html>
|
</html>
|
||||||
"""
|
"""
|
||||||
else:
|
else:
|
||||||
return '<p><a href="/list">user and tag list</a> | <a href="/documentation">Documentation</a></p><p>Error: 757</p> '
|
return render_template("error.html", error_code="757")
|
||||||
|
|
||||||
|
|
||||||
@app.route("/change", methods=['GET'])
|
@app.route("/change", methods=['GET'])
|
||||||
|
@ -188,7 +190,7 @@ def create_app(test_config=None):
|
||||||
user_id = request.args.get("id")
|
user_id = request.args.get("id")
|
||||||
change = int(request.args.get("change"))
|
change = int(request.args.get("change"))
|
||||||
except:
|
except:
|
||||||
return '<p>Error: 095</p><a href="/list">tags and user list</a>'
|
return render_template("error.html", error_code="095")
|
||||||
c.execute(f"SELECT * FROM users WHERE id=?", [user_id])
|
c.execute(f"SELECT * FROM users WHERE id=?", [user_id])
|
||||||
users = c.fetchall()
|
users = c.fetchall()
|
||||||
if users != []:
|
if users != []:
|
||||||
|
@ -207,14 +209,14 @@ def create_app(test_config=None):
|
||||||
</html>
|
</html>
|
||||||
"""
|
"""
|
||||||
else:
|
else:
|
||||||
return '<p><a href="/list">user and tag list</a> | <a href="/documentation">Documentation</a></p> <p>Error: 043</p>'
|
return render_template("error.html", error_code="043")
|
||||||
|
|
||||||
@app.route("/addtag", methods=['GET'])
|
@app.route("/addtag", methods=['GET'])
|
||||||
def get_addtag_request():
|
def get_addtag_request():
|
||||||
try:
|
try:
|
||||||
user_id = int(request.args.get("id"))
|
user_id = int(request.args.get("id"))
|
||||||
except: #except im Normalen Code!
|
except: #except im Normalen Code!
|
||||||
return "Error: 095"
|
return render_template("error.html", error_code="095")
|
||||||
session_id = uuid.uuid4()
|
session_id = uuid.uuid4()
|
||||||
session[id] = session_id
|
session[id] = session_id
|
||||||
user_queue.put([user_id, "add", session_id])
|
user_queue.put([user_id, "add", session_id])
|
||||||
|
@ -252,7 +254,7 @@ def create_app(test_config=None):
|
||||||
try:
|
try:
|
||||||
user_id = int(request.args.get("id"))
|
user_id = int(request.args.get("id"))
|
||||||
except: #except im Normalen Code!
|
except: #except im Normalen Code!
|
||||||
return "Wrong user id!"
|
return render_template("error.html", error_code="043")
|
||||||
session_id = uuid.uuid4()
|
session_id = uuid.uuid4()
|
||||||
session[id] = session_id
|
session[id] = session_id
|
||||||
user_queue.put([user_id, "remove", session_id])
|
user_queue.put([user_id, "remove", session_id])
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
<title>add user</title>
|
||||||
<p><a href="/list">user and tag list</a> | <a href="/documentation">Documentation</a></p>
|
<p><a href="/list">user and tag list</a> | <a href="/documentation">Documentation</a></p>
|
||||||
<p>
|
<p>
|
||||||
Username:
|
Username:
|
||||||
|
|
Loading…
Reference in a new issue