From 0f8801fa1e0933420fba6c571909e4f37b451425 Mon Sep 17 00:00:00 2001 From: "Manuel Weiser (aider)" Date: Mon, 2 Sep 2024 17:13:39 +0200 Subject: [PATCH] feat: restrict search functionality to authenticated users only --- game_collection/app.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/game_collection/app.py b/game_collection/app.py index 31a4891..5fcd757 100644 --- a/game_collection/app.py +++ b/game_collection/app.py @@ -52,6 +52,9 @@ def get_games(): @app.route('/games/search', methods=['GET']) def search_game_api(): + if not authenticate(): # Ensure the user is authenticated + return jsonify({'message': 'Unauthorized access!'}), 401 + search_term = request.args.get('search_keywords') if not search_term: return jsonify({'message': 'No search term provided!'}), 400