This commit is contained in:
maaa 2023-07-10 19:25:08 +02:00
parent 8330a8a5be
commit 7470ea2c98
3 changed files with 16 additions and 6 deletions

9
main
View File

@ -337,8 +337,7 @@ def apipost():
if not user["banned"] == "0": if not user["banned"] == "0":
return { return {
"error": "banned", "error": "banned"
"reason": user["banned"]
}, 403 }, 403
conn = get_db_connection() conn = get_db_connection()
@ -391,8 +390,7 @@ def post():
user = get_user(userCookie["id"]) user = get_user(userCookie["id"])
if not user["banned"] == "0": if not user["banned"] == "0":
flash("Your account has been banned. Reason: " + flash("Your account has been banned. You may no longer perform this action.")
user["banned"])
return redirect(url_for("post")) return redirect(url_for("post"))
filename = secure_filename(file.filename) filename = secure_filename(file.filename)
@ -438,8 +436,7 @@ def comment():
if not user["banned"] == "0": if not user["banned"] == "0":
return { return {
"error": "banned", "error": "banned"
"reason": user["banned"]
}, 403 }, 403
conn = get_db_connection() conn = get_db_connection()

View File

@ -163,6 +163,13 @@ body {
text-decoration: none; text-decoration: none;
} }
.warning {
width: 100%;
background-color: #f1b739;
color: black;
padding: 10px;
}
.hidden { .hidden {
display: none; display: none;
} }

View File

@ -29,6 +29,12 @@
</script> </script>
<div class="postDiv"> <div class="postDiv">
{% if userdata %}
{% if userdata.banned == "0" %}
{% else %}
<p class="warning">Your account has been banned. Reason: "{{ userdata.banned }}". <a href="/settings/logout">Log out</a></p>
{% endif %}
{% endif %}
{% for post in posts %} {% for post in posts %}
<div class="post" id="post"> <div class="post" id="post">
<p><a href='/@{{ getUser(post["creator"])["username"] }}' class="username usernamelink">{{ getUser(post["creator"])["username"] }}</a></p> <p><a href='/@{{ getUser(post["creator"])["username"] }}' class="username usernamelink">{{ getUser(post["creator"])["username"] }}</a></p>