Check for valid time tracker URL

This commit is contained in:
Hillel Coren 2018-03-12 22:15:42 +02:00
parent 45ab98c62e
commit e812234314
2 changed files with 4 additions and 2 deletions

View File

@ -2772,6 +2772,7 @@ $LANG = array(
'slack_incoming_webhooks' => 'Slack incoming webhooks', 'slack_incoming_webhooks' => 'Slack incoming webhooks',
'accept' => 'Accept', 'accept' => 'Accept',
'accepted_terms' => 'Successfully accepted the latest terms of service', 'accepted_terms' => 'Successfully accepted the latest terms of service',
'invalid_url' => 'Invalid URL',
); );

View File

@ -146,13 +146,14 @@
showCancelButton: true, showCancelButton: true,
confirmButtonText: 'Save', confirmButtonText: 'Save',
}).then(function (value) { }).then(function (value) {
if (!value) { if (! value || value.indexOf('http') !== 0) {
swal("{{ trans('texts.invalid_url') }}")
return; return;
} }
value = value.replace(/\/+$/, '') + '/time_tracker'; value = value.replace(/\/+$/, '') + '/time_tracker';
localStorage.setItem('last:time_tracker:url', value); localStorage.setItem('last:time_tracker:url', value);
location.reload(); location.reload();
}) }).catch(swal.noop);
} }
@endif @endif