From 4c9f27aa1fd4bd62418f84599186fcec2a3136ef Mon Sep 17 00:00:00 2001 From: Aevann Date: Fri, 27 Jan 2023 11:26:59 +0200 Subject: [PATCH] make /send_admin redirect to /contact --- files/routes/static.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/files/routes/static.py b/files/routes/static.py index d08065346..c3356b6dd 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -213,7 +213,12 @@ def api(v): @app.get("/media") @auth_desired def contact(v:Optional[User]): - return render_template("contact.html", v=v) + if request.referrer and request.referrer.split('?')[0] == request.base_url: + msg = request.values.get("msg") + else: + msg = None + + return render_template("contact.html", v=v, msg=msg) @app.post("/send_admin") @limiter.limit("1/second;1/2 minutes;10/day") @@ -252,8 +257,7 @@ def submit_contact(v): g.db.add(notif) - - return render_template("contact.html", v=v, msg="Your message has been sent to the admins!") + return redirect("/contact?msg=Your message has been sent to the admins!") @app.get('/archives') def archivesindex():