diff options
-rw-r--r-- | ogcp/forms/action_forms.py | 3 | ||||
-rw-r--r-- | ogcp/views.py | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/ogcp/forms/action_forms.py b/ogcp/forms/action_forms.py index c111940..7fbaa79 100644 --- a/ogcp/forms/action_forms.py +++ b/ogcp/forms/action_forms.py @@ -126,7 +126,8 @@ class FolderForm(FlaskForm): class ClientDetailsForm(FlaskForm): server = HiddenField() - name = StringField(label=_l('Name')) + name = StringField(label=_l('Name'), + validators=[InputRequired()]) ip = StringField(label=_l('IP'), validators=[InputRequired()]) mac = StringField(label=_l('MAC'), 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: |