luci-mod-network: fix key option quirk when switching wep and wpa modes
authorJo-Philipp Wich <jo@mein.io>
Fri, 20 Sep 2019 11:39:22 +0000 (13:39 +0200)
committerJo-Philipp Wich <jo@mein.io>
Fri, 20 Sep 2019 11:39:22 +0000 (13:39 +0200)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js

index 595cd1e221d25473f5c94c78916a575fb580cf92..f4ded41fe350fa8f515f44bd160a37b1c46c19d6 100644 (file)
@@ -1252,6 +1252,9 @@ return L.view.extend({
                                o.write = function(section_id, value) {
                                        uci.set('wireless', section_id, 'key', value);
                                        uci.unset('wireless', section_id, 'key1');
+                                       uci.unset('wireless', section_id, 'key2');
+                                       uci.unset('wireless', section_id, 'key3');
+                                       uci.unset('wireless', section_id, 'key4');
                                };
 
 
@@ -1265,7 +1268,7 @@ return L.view.extend({
 
                                o.cfgvalue = function(section_id) {
                                        var slot = +uci.get('wireless', section_id, 'key');
-                                       return String((slot >= 1 && slot <= 4) ? slot : 1);
+                                       return (slot >= 1 && slot <= 4) ? String(slot) : '';
                                };
 
                                o.write = function(section_id, value) {