From: Paul Donald Date: Thu, 25 Jan 2024 00:05:15 +0000 (+0100) Subject: luci-mod-network: improve static lease ip validation logic X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=31eaf011a75126c2e35e14dba0337eb083569b7e;p=project%2Fluci.git luci-mod-network: improve static lease ip validation logic m (mac) is an array, and is zero length or greater. Signed-off-by: Paul Donald (cherry picked from commit f6cbda00e77afc26c12da3c31e5f5444cee17422) --- diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js index a123f9b342..889f132ab0 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js @@ -843,10 +843,10 @@ return view.extend({ var m = this.section.formvalue(section, 'mac'), n = this.section.formvalue(section, 'name'); - if ((m == null || m == '') && (n == null || n == '')) + if ((m && !m.length > 0) && !n) return _('One of hostname or MAC address must be specified!'); - if (value == null || value == '' || value == 'ignore') + if (!value || value == 'ignore') return true; var leases = uci.sections('dhcp', 'host');