From 1a3d7a3d00d20005ce1842aa83bee629bdd3c770 Mon Sep 17 00:00:00 2001 From: Daniel Steglich Date: Mon, 9 Mar 2015 22:36:21 +0100 Subject: [PATCH] only validate form fileds if the form is enabled at all --- plinth/modules/dynamicdns/dynamicdns.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/plinth/modules/dynamicdns/dynamicdns.py b/plinth/modules/dynamicdns/dynamicdns.py index 76e119024..613ce1aa5 100644 --- a/plinth/modules/dynamicdns/dynamicdns.py +++ b/plinth/modules/dynamicdns/dynamicdns.py @@ -174,16 +174,17 @@ class ConfigureForm(forms.Form): else: dynamicdns_server = "" - """check if gnudip server or update URL is filled""" - if not dynamicdns_update_url and not dynamicdns_server: - raise forms.ValidationError('please give update URL or \ - a GnuDIP Server') - LOGGER.info('no server address given') + if cleaned_data.get('enabled'): + """check if gnudip server or update URL is filled""" + if not dynamicdns_update_url and not dynamicdns_server: + raise forms.ValidationError('please give update URL or \ + a GnuDIP Server') + LOGGER.info('no server address given') - """check if a password was set before or a password is set now""" - if not dynamicdns_secret and not old_dynamicdns_secret: - raise forms.ValidationError('please give a password') - LOGGER.info('no password given') + """check if a password was set before or a password is set now""" + if not dynamicdns_secret and not old_dynamicdns_secret: + raise forms.ValidationError('please give a password') + LOGGER.info('no password given') @login_required