summaryrefslogtreecommitdiffstats
path: root/ogcp/views.py
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-07-04 11:52:08 +0200
committerlupoDharkael <izhe@hotmail.es>2024-07-09 09:52:21 +0200
commite532e9a0c86e1ad88862c2d2ce5ecc222403e966 (patch)
tree4c383cecfcfd50f76d2c43a1388e08be2a1492b9 /ogcp/views.py
parent5111733b93adb4f64c77caa6baf74aca987ce897 (diff)
ogcp: make client name field mandatory in client form
Add InputRequired validator to the name field of the ClientDetailsForm. Validate name value in the POST function.
Diffstat (limited to 'ogcp/views.py')
-rw-r--r--ogcp/views.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/ogcp/views.py b/ogcp/views.py
index 9887d47..2dba569 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -1567,6 +1567,12 @@ def action_client_add():
flash(form.errors, category='error')
return redirect(url_for('scopes'))
+ client_name = form.name.data
+
+ if not client_name:
+ flash(_('Invalid empty client name'), category='error')
+ return redirect(url_for("scopes"))
+
try:
ipaddress.ip_address(form.ip.data)
except ValueError as e: