From: Calin Crisan Date: Sun, 22 Feb 2015 18:54:41 +0000 (+0200) Subject: camera names and email addresses are now validated X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=e9e96a0b67385ab9ed50ea850da23abd2dbfe7dc;p=motioneye-debian camera names and email addresses are now validated --- diff --git a/static/js/main.js b/static/js/main.js index 43c8979..4cce2c3 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -490,6 +490,17 @@ function initUI() { makeTimeValidator($('input[type=text].time')); /* custom validators */ + makeCustomValidator($('#deviceNameEntry'), function (value) { + if (!value) { + return 'this field is required'; + } + + if (!value.toLowerCase().match(new RegExp('^[a-z0-9\-\_\+\ ]*$'))) { + return "special characters are not allowed in camera's name"; + } + + return true; + }, ''); makeCustomValidator($('#rootDirectoryEntry'), function (value) { if ($('#storageDeviceSelect').val() == 'custom-path' && String(value).trim() == '/') { return 'files cannot be created directly on the root of your system'; @@ -497,6 +508,13 @@ function initUI() { return true; }, ''); + makeCustomValidator($('#emailAddressesEntry'), function (value) { + if (!value.toLowerCase().match(new RegExp('^[a-z0-9\-\_\+\.\@\^\~\, ]+$'))) { + return 'enter a list of comma-separated valid email addresses'; + } + + return true; + }, ''); /* input value processors */ makeStrippedInput($('tr[strip=true] input[type=text]'));