From 54ca0f73f0c5f2822ef04a1a502160e235e8fbd7 Mon Sep 17 00:00:00 2001 From: Aidaho Date: Fri, 3 May 2024 19:58:43 +0300 Subject: [PATCH] v7.2.5.0: Add middleware to get user params in create methods This commit adjusts the 'create_user' and 'create_server' routes to include a decorator for getting user parameters. This will improve the handling of these methods, ensuring they receive any necessary user specific parameters. --- app/routes/server/routes.py | 3 ++- app/routes/user/routes.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/routes/server/routes.py b/app/routes/server/routes.py index 0d1a7dc7..b9d50be6 100644 --- a/app/routes/server/routes.py +++ b/app/routes/server/routes.py @@ -55,7 +55,8 @@ def show_if(server_ip): return server_mod.ssh_command(server_ip, command) -@bp.route('/create', methods=['POST']) +@bp.post('/create') +@get_user_params() def create_server(): roxywi_auth.page_for_admin(level=2) hostname = common.checkAjaxInput(request.form.get('servername')) diff --git a/app/routes/user/routes.py b/app/routes/user/routes.py index 314fb42e..1ee74f46 100644 --- a/app/routes/user/routes.py +++ b/app/routes/user/routes.py @@ -11,6 +11,7 @@ import app.modules.common.common as common import app.modules.roxywi.user as roxywi_user import app.modules.roxywi.auth as roxywi_auth import app.modules.roxywi.common as roxywi_common +from app.middleware import get_user_params @bp.before_request @@ -21,6 +22,7 @@ def before_request(): @bp.post('/create') +@get_user_params() def create_user(): roxywi_auth.page_for_admin(level=2) email = common.checkAjaxInput(request.form.get('newemail'))