error.html template

This commit is contained in:
2000-Trek 2023-09-19 22:23:55 +02:00
parent 9a7b4ca5a7
commit ad786ddff2
2 changed files with 12 additions and 9 deletions

View file

@ -86,6 +86,7 @@ def create_app(test_config=None):
window.location="http://matekasse.server.c3h/list"
});
</script>
<title>Strichliste</title>
<p><a href="/list">user and tag list</a> | <a href="/documentation">Documentation</a></p>
<p>1 Credit = 1,50 Euro</p>
<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();
""" + 'socket.on("update", function(){ window.location="http://matekasse.server.c3h/list/user?id=' + id + '"});' + f"""
</script>
<title>{escape(user[1])}</title>
<p><a href="/list">user and tag list</a> | <a href="/documentation">Documentation</a></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>
@ -128,7 +130,7 @@ def create_app(test_config=None):
</html>
"""
else:
return "Error: 043"
return render_template("error.html", error_code="043")
@app.route("/adduser")
def new_user():
@ -149,9 +151,9 @@ def create_app(test_config=None):
app.logger.info(f"Deleted user ?", [user_id])
db.commit()
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:
return "Error: 043"
return render_template("error.html", error_code="043")
@app.route("/adduser/user", methods=['GET'])
def adduser():
@ -159,7 +161,7 @@ def create_app(test_config=None):
c = db.cursor()
username = request.args.get("username")
if username == None:
return "418"
return render_template("error.html", error_code="418")
c.execute("SELECT * FROM users WHERE username=?", [username])
if c.fetchall() == []:
c.execute("INSERT or IGNORE INTO users (username, balance) VALUES (?, 0)", [username])
@ -177,7 +179,7 @@ def create_app(test_config=None):
</html>
"""
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'])
@ -188,7 +190,7 @@ def create_app(test_config=None):
user_id = request.args.get("id")
change = int(request.args.get("change"))
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])
users = c.fetchall()
if users != []:
@ -207,14 +209,14 @@ def create_app(test_config=None):
</html>
"""
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'])
def get_addtag_request():
try:
user_id = int(request.args.get("id"))
except: #except im Normalen Code!
return "Error: 095"
return render_template("error.html", error_code="095")
session_id = uuid.uuid4()
session[id] = session_id
user_queue.put([user_id, "add", session_id])
@ -252,7 +254,7 @@ def create_app(test_config=None):
try:
user_id = int(request.args.get("id"))
except: #except im Normalen Code!
return "Wrong user id!"
return render_template("error.html", error_code="043")
session_id = uuid.uuid4()
session[id] = session_id
user_queue.put([user_id, "remove", session_id])

View file

@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="en">
<title>add user</title>
<p><a href="/list">user and tag list</a> | <a href="/documentation">Documentation</a></p>
<p>
Username: