diff --git a/actions/dynamicdns b/actions/dynamicdns index d66f145e7..cf1207518 100755 --- a/actions/dynamicdns +++ b/actions/dynamicdns @@ -54,7 +54,11 @@ doGetOpt() while getopts ":s:d:u:p:I:U:c:b:" opt; do case ${opt} in s) - server=${OPTARG} + if [ "${OPTARG}" != "${EMPTYSTRING}" ];then + server=${OPTARG} + else + server="" + fi ;; d) host=${OPTARG} diff --git a/plinth/modules/dynamicdns/dynamicdns.py b/plinth/modules/dynamicdns/dynamicdns.py index e04ad36ea..a347645ed 100644 --- a/plinth/modules/dynamicdns/dynamicdns.py +++ b/plinth/modules/dynamicdns/dynamicdns.py @@ -29,6 +29,7 @@ from plinth import cfg from plinth import package LOGGER = logging.getLogger(__name__) +EMPTYSTRING = 'none' subsubmenu = [{'url': reverse_lazy('dynamicdns:index'), 'text': _('About')}, @@ -170,12 +171,15 @@ class ConfigureForm(forms.Form): dynamicdns_server = cleaned_data.get('dynamicdns_server') old_dynamicdns_secret = self.initial['dynamicdns_secret'] + """Todo: this is not working!! will see tomorrow why""" 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 not dynamicdns_secret and not old_dynamicdns_secret: raise forms.ValidationError('please give a password') + LOGGER.info('no password given') @login_required @@ -311,27 +315,15 @@ def _apply_changes(request, old_status, new_status): new_status['dynamicdns_secret'] = old_status['dynamicdns_secret'] if new_status['dynamicdns_ipurl'] == '': - new_status['dynamicdns_ipurl'] = 'none' + new_status['dynamicdns_ipurl'] = EMPTYSTRING - if old_status['dynamicdns_server'] != \ - new_status['dynamicdns_server'] or \ - old_status['dynamicdns_domain'] != \ - new_status['dynamicdns_domain'] or \ - old_status['dynamicdns_user'] != \ - new_status['dynamicdns_user'] or \ - old_status['dynamicdns_secret'] != \ - new_status['dynamicdns_secret'] or \ - old_status['dynamicdns_ipurl'] != \ - new_status['dynamicdns_ipurl'] or \ - old_status['dynamicdns_update_url'] != \ - new_status['dynamicdns_update_url'] or \ - old_status['disable_SSL_cert_check'] != \ - new_status['disable_SSL_cert_check'] or \ - old_status['use_http_basic_auth'] != \ - new_status['use_http_basic_auth'] or \ - old_status['enabled'] != \ - new_status['enabled']: + if new_status['dynamicdns_update_url'] == '': + new_status['dynamicdns_update_url'] = EMPTYSTRING + if new_status['dynamicdns_server'] == '': + new_status['dynamicdns_server'] = EMPTYSTRING + + if old_status != new_status: disable_ssl_check = "disabled" use_http_basic_auth = "disabled" @@ -357,6 +349,8 @@ def _apply_changes(request, old_status, new_status): messages.success(request, _('Dynamic DNS configuration is updated!')) + else: + LOGGER.info('nothing changed') def _run(arguments, superuser=False): diff --git a/plinth/modules/dynamicdns/templates/dynamicdns_configure.html b/plinth/modules/dynamicdns/templates/dynamicdns_configure.html index c6e6eb53c..df0538ba5 100644 --- a/plinth/modules/dynamicdns/templates/dynamicdns_configure.html +++ b/plinth/modules/dynamicdns/templates/dynamicdns_configure.html @@ -14,7 +14,7 @@ # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# along with this program. If not, see http://www.gnu.org/licenses/. # {% endcomment %} @@ -32,8 +32,8 @@

Dynamic DNS type

You have disabled Javascript. Dynamic form mode is disabled and - some helper functions may not work
(but the main functionality should work) -

+ some helper functions may not work
(but the main functionality should work) +