From e29915dc6b41081fffd4707823b1670d9bbe5b40 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Fri, 13 Jan 2023 21:26:52 +0100 Subject: [PATCH] luci-app-nlbwmon: validate date input Fixes: #6188 Signed-off-by: Jo-Philipp Wich (cherry picked from commit 7c7ac8bf0d9d554d19f5d21226110743899b8802) --- .../htdocs/luci-static/resources/view/nlbw/config.js | 3 +++ 1 file changed, 3 insertions(+) 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'); -- 2.30.2