summaryrefslogtreecommitdiffstats
path: root/ogcp
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2021-07-29 12:36:07 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2021-07-29 16:41:17 +0200
commit05bab71162ddd382e7662f0774ca6b90a5c154d5 (patch)
tree56628b6442574b3bf3bad860af6bf337f05b07d8 /ogcp
parente64a33a3dd2f8bbdfcc9617f2fee58ce1acbb0e0 (diff)
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.
Diffstat (limited to 'ogcp')
-rw-r--r--ogcp/views.py4
1 files changed, 4 insertions, 0 deletions
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()