From 2a2c512639e4c8741e7b663d6ce8e95ebcd7ef12 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 22 Aug 2021 22:31:12 +0200 Subject: [PATCH] fdfd --- files/mail/mail.py | 2 +- files/routes/awards.py | 15 +++++++-------- files/routes/comments.py | 2 +- files/routes/oauth.py | 2 +- files/routes/posts.py | 10 +++++----- files/routes/votes.py | 4 ++-- 6 files changed, 17 insertions(+), 18 deletions(-) diff --git a/files/mail/mail.py b/files/mail/mail.py index 29e33af10..d98cfa809 100644 --- a/files/mail/mail.py +++ b/files/mail/mail.py @@ -55,7 +55,7 @@ def send_verification_email(user, email=None): @app.post("/verify_email") -@is_not_banned +@auth_required def api_verify_email(v): send_verification_email(v) diff --git a/files/routes/awards.py b/files/routes/awards.py index ffb89ae7c..1402a5da1 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -12,16 +12,15 @@ def banaward_trigger(post=None, comment=None): author = post.author if post else comment.author link = f"[this post]({post.permalink})" if post else f"[this comment]({comment.permalink})" - if author.admin_level < 1: - if not author.is_suspended: - author.ban(reason="one-day ban award used", days=1) + if not author.is_suspended: + author.ban(reason="one-day ban award used", days=1) - send_notification(NOTIFICATIONS_ACCOUNT, author, f"Your account has been suspended for a day for {link}. It sucked and you should feel bad.") - elif author.unban_utc > 0: - author.unban_utc += 24*60*60 - g.db.add(author) + send_notification(NOTIFICATIONS_ACCOUNT, author, f"Your account has been suspended for a day for {link}. It sucked and you should feel bad.") + elif author.unban_utc > 0: + author.unban_utc += 24*60*60 + g.db.add(author) - send_notification(NOTIFICATIONS_ACCOUNT, author, f"Your account has been suspended for yet another day for {link}. Seriously man?") + send_notification(NOTIFICATIONS_ACCOUNT, author, f"Your account has been suspended for yet another day for {link}. Seriously man?") ACTIONS = { diff --git a/files/routes/comments.py b/files/routes/comments.py index ef6c901c5..f5b2aca40 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -521,7 +521,7 @@ def api_comment(v): @app.post("/edit_comment/") -@is_not_banned +@auth_required @validate_formkey def edit_comment(cid, v): diff --git a/files/routes/oauth.py b/files/routes/oauth.py index f9b3cabd0..b562f4c1f 100644 --- a/files/routes/oauth.py +++ b/files/routes/oauth.py @@ -54,7 +54,7 @@ def request_api_keys(v): @app.post("/delete_app/") -@is_not_banned +@auth_required @validate_formkey def delete_oauth_app(v, aid): diff --git a/files/routes/posts.py b/files/routes/posts.py index 257917a20..c03c64053 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -24,7 +24,7 @@ site = environ.get("DOMAIN").strip() with open("snappy.txt", "r") as f: snappyquotes = f.read().split("{[para]}") @app.post("/publish/") -@is_not_banned +@auth_required @validate_formkey def publish(pid, v): post = get_post(pid) @@ -224,7 +224,7 @@ def post_id(pid, anything=None, v=None): @app.post("/edit_post/") -@is_not_banned +@auth_required @validate_formkey def edit_post(pid, v): @@ -345,7 +345,7 @@ def edit_post(pid, v): @app.get("/submit/title") @limiter.limit("6/minute") -@is_not_banned +@auth_required def get_post_title(v): url = request.args.get("url", None) @@ -955,7 +955,7 @@ def undelete_post_pid(pid, v): @app.post("/toggle_comment_nsfw/") -@is_not_banned +@auth_required @validate_formkey def toggle_comment_nsfw(cid, v): @@ -966,7 +966,7 @@ def toggle_comment_nsfw(cid, v): return "", 204 @app.post("/toggle_post_nsfw/") -@is_not_banned +@auth_required @validate_formkey def toggle_post_nsfw(pid, v): diff --git a/files/routes/votes.py b/files/routes/votes.py index eeb4a625a..5b8518c1e 100644 --- a/files/routes/votes.py +++ b/files/routes/votes.py @@ -55,7 +55,7 @@ def admin_vote_info_get(v): @app.post("/vote/post//") -@is_not_banned +@auth_required @validate_formkey def api_vote_post(post_id, new, v): @@ -101,7 +101,7 @@ def api_vote_post(post_id, new, v): return "", 204 @app.post("/vote/comment//") -@is_not_banned +@auth_required @validate_formkey def api_vote_comment(comment_id, new, v):