mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-02-11 08:23:49 +00:00
covered empty server arguments and made parameter comparsion more easy
This commit is contained in:
parent
21f0aeef1c
commit
e42b8e5015
@ -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}
|
||||
|
||||
@ -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):
|
||||
|
||||
@ -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 <http://www.gnu.org/licenses/>.
|
||||
# along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
#
|
||||
{% endcomment %}
|
||||
|
||||
@ -32,8 +32,8 @@
|
||||
<h3>Dynamic DNS type</h3>
|
||||
<div id='dynamicdns-no-js'>
|
||||
You have disabled Javascript. Dynamic form mode is disabled and
|
||||
some helper functions may not work </br> (but the main functionality should work)
|
||||
</br><hr>
|
||||
some helper functions may not work <br> (but the main functionality should work)
|
||||
<br><hr>
|
||||
</div>
|
||||
<div id='div-dynamicdns-dropdown' style="display:none">
|
||||
{% include 'bootstrapform/field.html' with field=form.service_type %}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user