Browse Source

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
commit
54ca0f73f0
  1. 3
      app/routes/server/routes.py
  2. 2
      app/routes/user/routes.py

3
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'))

2
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'))

Loading…
Cancel
Save