From 275675b48add79d2bbce06426cc1224c5e2c1bfb Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sun, 5 Feb 2023 09:27:56 +0100 Subject: [PATCH] Search query is now also a post request (possible fix for Forward Auth Search Redirect Issue #2681) --- cps/search.py | 7 ++++--- cps/templates/layout.html | 3 ++- cps/web.py | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cps/search.py b/cps/search.py index 096b2928..96f21d62 100644 --- a/cps/search.py +++ b/cps/search.py @@ -35,12 +35,13 @@ search = Blueprint('search', __name__) log = logger.create() -@search.route("/search", methods=["GET"]) +@search.route("/search", methods=["POST"]) @login_required_if_no_ano def simple_search(): - term = request.args.get("query") + term = dict(request.form).get("query") if term: - return redirect(url_for('web.books_list', data="search", sort_param='stored', query=term.strip())) + flask_session['query'] = json.dumps(term.strip()) + return redirect(url_for('web.books_list', data="search", sort_param='stored', query="")) # term.strip() else: return render_title_template('search.html', searchterm="", diff --git a/cps/templates/layout.html b/cps/templates/layout.html index 07adbabd..f6423bb3 100644 --- a/cps/templates/layout.html +++ b/cps/templates/layout.html @@ -41,7 +41,8 @@
{% endif %} {% if current_user.is_authenticated or g.allow_anonymous %} -