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.
pull/381/head
Aidaho 7 months ago
parent 019478f534
commit 54ca0f73f0

@ -55,7 +55,8 @@ def show_if(server_ip):
return server_mod.ssh_command(server_ip, command) return server_mod.ssh_command(server_ip, command)
@bp.route('/create', methods=['POST']) @bp.post('/create')
@get_user_params()
def create_server(): def create_server():
roxywi_auth.page_for_admin(level=2) roxywi_auth.page_for_admin(level=2)
hostname = common.checkAjaxInput(request.form.get('servername')) hostname = common.checkAjaxInput(request.form.get('servername'))

@ -11,6 +11,7 @@ import app.modules.common.common as common
import app.modules.roxywi.user as roxywi_user import app.modules.roxywi.user as roxywi_user
import app.modules.roxywi.auth as roxywi_auth import app.modules.roxywi.auth as roxywi_auth
import app.modules.roxywi.common as roxywi_common import app.modules.roxywi.common as roxywi_common
from app.middleware import get_user_params
@bp.before_request @bp.before_request
@ -21,6 +22,7 @@ def before_request():
@bp.post('/create') @bp.post('/create')
@get_user_params()
def create_user(): def create_user():
roxywi_auth.page_for_admin(level=2) roxywi_auth.page_for_admin(level=2)
email = common.checkAjaxInput(request.form.get('newemail')) email = common.checkAjaxInput(request.form.get('newemail'))

Loading…
Cancel
Save