luci-mod-status: fix wrong logic for maclist adding feature
Currently any new entry added to the black/whitelist deletes the
others. Fix this and improve the rule apply by firstly disconnect
the wifi client.
Fixes: #5343
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
(cherry picked from commit 085c4a08f5
)
This commit is contained in:
parent
2fe3d0ab4a
commit
06419e9a9c
1 changed files with 12 additions and 15 deletions
|
@ -48,21 +48,18 @@ return baseclass.extend({
|
||||||
ev.currentTarget.disabled = true;
|
ev.currentTarget.disabled = true;
|
||||||
ev.currentTarget.blur();
|
ev.currentTarget.blur();
|
||||||
|
|
||||||
|
/* Disconnect client before adding to maclist */
|
||||||
|
wifinet.disconnectClient(mac, true, 5, 60000);
|
||||||
|
|
||||||
if (exec == 'addlist') {
|
if (exec == 'addlist') {
|
||||||
var macs = [ mac ]
|
wifinet.maclist.push(mac);
|
||||||
|
|
||||||
for (var mac in this.iface_maclist) {
|
uci.set('wireless', wifinet.sid, 'maclist', wifinet.maclist);
|
||||||
macs.push(mac)
|
|
||||||
}
|
|
||||||
|
|
||||||
uci.set('wireless', wifinet.sid, 'maclist', macs);
|
|
||||||
|
|
||||||
return uci.save()
|
return uci.save()
|
||||||
.then(L.bind(L.ui.changes.init, L.ui.changes))
|
.then(L.bind(L.ui.changes.init, L.ui.changes))
|
||||||
.then(L.bind(L.ui.changes.displayChanges, L.ui.changes));
|
.then(L.bind(L.ui.changes.displayChanges, L.ui.changes));
|
||||||
}
|
}
|
||||||
|
|
||||||
wifinet.disconnectClient(mac, true, 5, 60000);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
handleGetWPSStatus: function(wifinet) {
|
handleGetWPSStatus: function(wifinet) {
|
||||||
|
@ -234,14 +231,14 @@ return baseclass.extend({
|
||||||
var rows = [];
|
var rows = [];
|
||||||
|
|
||||||
for (var i = 0; i < networks.length; i++) {
|
for (var i = 0; i < networks.length; i++) {
|
||||||
var macfilter = uci.get('wireless', networks[i].sid, 'macfilter');
|
var macfilter = uci.get('wireless', networks[i].sid, 'macfilter'),
|
||||||
|
maclist = {};
|
||||||
|
|
||||||
if (macfilter != null && macfilter != 'disable') {
|
if (macfilter != null && macfilter != 'disable') {
|
||||||
this.isDeviceAdded = {};
|
networks[i].maclist = L.toArray(uci.get('wireless', networks[i].sid, 'maclist'));
|
||||||
var macs = L.toArray(uci.get('wireless', networks[i].sid, 'maclist'));
|
for (var j = 0; j < networks[i].maclist.length; j++) {
|
||||||
for (var j = 0; j < macs.length; j++) {
|
var mac = networks[i].maclist[j].toUpperCase();
|
||||||
var mac = macs[j].toUpperCase();
|
maclist[mac] = true;
|
||||||
this.isDeviceAdded[mac] = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,7 +321,7 @@ return baseclass.extend({
|
||||||
if (assoclist.firstElementChild.childNodes.length < 6)
|
if (assoclist.firstElementChild.childNodes.length < 6)
|
||||||
assoclist.firstElementChild.appendChild(E('th', { 'class': 'th cbi-section-actions' }));
|
assoclist.firstElementChild.appendChild(E('th', { 'class': 'th cbi-section-actions' }));
|
||||||
|
|
||||||
if (macfilter != null && macfilter != 'disable' && !this.isDeviceAdded[bss.mac]) {
|
if (macfilter != null && macfilter != 'disable' && !maclist[bss.mac]) {
|
||||||
row.push(new L.ui.ComboButton('button', {
|
row.push(new L.ui.ComboButton('button', {
|
||||||
'addlist': macfilter == 'allow' ? _('Add to Whitelist') : _('Add to Blacklist'),
|
'addlist': macfilter == 'allow' ? _('Add to Whitelist') : _('Add to Blacklist'),
|
||||||
'disconnect': _('Disconnect')
|
'disconnect': _('Disconnect')
|
||||||
|
|
Loading…
Reference in a new issue