summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ogcp/views.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/ogcp/views.py b/ogcp/views.py
index fd4eb01..d4f3506 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -29,6 +29,7 @@ from ogcp.og_server import OGServer, servers
from flask_babel import lazy_gettext as _l
from flask_babel import gettext, _
from ogcp import app, ogcp_cfg_path
+import ipaddress
import requests
import datetime
import hashlib
@@ -1234,6 +1235,13 @@ def action_client_info():
def action_client_update():
form = ClientDetailsForm(request.form)
if request.method == 'POST':
+
+ try:
+ ipaddress.ip_address(form.ip.data)
+ except ValueError as e:
+ flash(_('Invalid IP address'), category='error')
+ return redirect(url_for("scopes"))
+
payload = {"ip": form.ip.data,
"serial_number": form.serial_number.data,
"netdriver": "generic",
@@ -1480,6 +1488,12 @@ def action_client_add():
flash(form.errors, category='error')
return redirect(url_for('servers'))
+ try:
+ ipaddress.ip_address(form.ip.data)
+ except ValueError as e:
+ flash(_('Invalid IP address'), category='error')
+ return redirect(url_for("scopes"))
+
payload = {"boot": form.boot.data,
"ip": form.ip.data,
"livedir": form.livedir.data,