From 05bab71162ddd382e7662f0774ca6b90a5c154d5 Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Thu, 29 Jul 2021 12:36:07 +0200 Subject: Add IPs validation to Poweroff and Setup form Otherwise, users see an error page, instead of a float message asking to select at least one computer. --- ogcp/views.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ogcp') diff --git a/ogcp/views.py b/ogcp/views.py index 8babc30..b6db089 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -208,6 +208,8 @@ def scopes(): @login_required def action_poweroff(): ips = parse_ips(request.form.to_dict()) + if not validate_ips(ips): + return redirect(url_for('commands')) payload = {'clients': list(ips)} g.server.post('/poweroff', payload) return redirect(url_for('commands')) @@ -236,6 +238,8 @@ def action_wol(): def action_setup_show(ips=None): if not ips: ips = parse_ips(request.args.to_dict()) + if not validate_ips(ips): + return redirect(url_for('commands')) db_partitions = get_client_setup(ips) form = SetupForm() -- cgit v1.2.3-18-g5258