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 <newtwen@gmail.com>
This commit is contained in:
Paul Donald 2024-01-25 01:05:15 +01:00
parent 754b36d05a
commit f6cbda00e7

View file

@ -942,10 +942,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');