From 7c7ac8bf0d9d554d19f5d21226110743899b8802 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Fri, 13 Jan 2023 21:26:52 +0100 Subject: luci-app-nlbwmon: validate date input Fixes: #6188 Signed-off-by: Jo-Philipp Wich --- .../luci-app-nlbwmon/htdocs/luci-static/resources/view/nlbw/config.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'applications/luci-app-nlbwmon/htdocs/luci-static/resources/view/nlbw/config.js') diff --git a/applications/luci-app-nlbwmon/htdocs/luci-static/resources/view/nlbw/config.js b/applications/luci-app-nlbwmon/htdocs/luci-static/resources/view/nlbw/config.js index 3f0a4c969f..bdebf296ea 100644 --- a/applications/luci-app-nlbwmon/htdocs/luci-static/resources/view/nlbw/config.js +++ b/applications/luci-app-nlbwmon/htdocs/luci-static/resources/view/nlbw/config.js @@ -102,6 +102,9 @@ return view.extend({ return m ? m[1] : null; }; + o.validate = function(section_id, value) { + return /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/.exec(value) ? true : _('Require a valid date in the form "YYYY-MM-DD"'); + }; o.write = writePeriod; o.depends('_period', 'absolute'); -- cgit v1.2.3