diff options
Diffstat (limited to 'applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_add.lua')
-rw-r--r-- | applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_add.lua | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_add.lua b/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_add.lua index 31869478f..a3dd0a2b9 100644 --- a/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_add.lua +++ b/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_add.lua @@ -5,6 +5,8 @@ local fs = require("nixio.fs") local uci = require("luci.model.uci").cursor() local http = require("luci.http") local trmiface = uci.get("travelmate", "global", "trm_iface") or "trm_wwan" +local encr_psk = {"psk", "psk2", "psk-mixed"} +local encr_wpa = {"wpa", "wpa2", "wpa-mixed"} m = SimpleForm("add", translate("Add Wireless Uplink Configuration")) m.submit = translate("Save") @@ -53,7 +55,7 @@ elseif (tonumber(m.hidden.wpa_version) or 0) > 0 then encr:value("psk", "WPA PSK") encr:value("psk-mixed", "WPA/WPA2 mixed") encr:value("psk2", "WPA2 PSK") - encr.default = "psk2" + encr.default = encr_psk[tonumber(m.hidden.wpa_version)] or "psk2" ciph = m:field(ListValue, "cipher", translate("Cipher")) ciph:value("auto", translate("Automatic")) @@ -70,7 +72,7 @@ elseif (tonumber(m.hidden.wpa_version) or 0) > 0 then encr:value("wpa", "WPA Enterprise") encr:value("wpa-mixed", "WPA/WPA2 Enterprise mixed") encr:value("wpa2", "WPA2 Enterprise") - encr.default = "wpa2" + encr.default = encr_wpa[tonumber(m.hidden.wpa_version)] or "wpa2" ciph = m:field(ListValue, "cipher", translate("Cipher")) ciph:value("auto", translate("Automatic")) @@ -131,7 +133,7 @@ function wssid.write(self, section, value) bssid = bssid:formvalue(section), disabled = "1" }) - + if (tonumber(m.hidden.wep) or 0) == 1 then uci:set("wireless", newsection, "encryption", encr:formvalue(section)) uci:set("wireless", newsection, "key", wkey:formvalue(section) or "") |