summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_edit.lua
diff options
context:
space:
mode:
authorHannu Nyman <hannu.nyman@iki.fi>2017-12-06 18:58:25 +0200
committerGitHub <noreply@github.com>2017-12-06 18:58:25 +0200
commit78ebfba390168b7ba801db1ec8d694a7a90d3786 (patch)
treea9483469236023c4223f521de50a043b7a478b9e /applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_edit.lua
parentde4c4b806336f085d19b1b427dc82c65355ed345 (diff)
parent2474cdd049c7e9523cc5055a97a86229943a2f3a (diff)
Merge pull request #1465 from dibdot/travelmate
luci-app-travelmate: sync with travelmate 0.9.5
Diffstat (limited to 'applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_edit.lua')
-rw-r--r--applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_edit.lua37
1 files changed, 30 insertions, 7 deletions
diff --git a/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_edit.lua b/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_edit.lua
index c60ff22c4d..1baca5be40 100644
--- a/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_edit.lua
+++ b/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_edit.lua
@@ -1,9 +1,10 @@
-- Copyright 2017 Dirk Brenken (dev@brenken.org)
-- This is free software, licensed under the Apache License, Version 2.0
-local fs = require("nixio.fs")
-local uci = require("luci.model.uci").cursor()
+local fs = require("nixio.fs")
+local uci = require("luci.model.uci").cursor()
local http = require("luci.http")
+local val = ""
m = SimpleForm("edit", translate("Edit Wireless Uplink Configuration"))
m.submit = translate("Save")
@@ -21,8 +22,15 @@ m.hidden = {
local s = uci:get_all("wireless", m.hidden.cfg)
if s ~= nil then
wssid = m:field(Value, "ssid", translate("SSID"))
- wssid.default = s.ssid
wssid.datatype = "rangelength(1,32)"
+ wssid.default = s.ssid
+ bssid = m:field(Value, "bssid", translate("BSSID"))
+ bssid.datatype = "macaddr"
+ bssid.default = s.bssid
+ if s.identity then
+ ident = m:field(Value, "identity", translate("Identity"))
+ ident.default = s.identity
+ end
if s.encryption and s.key then
wkey = m:field(Value, "key", translatef("Passphrase (%s)", s.encryption))
elseif s.encryption and s.password then
@@ -43,10 +51,25 @@ end
function wssid.write(self, section, value)
uci:set("wireless", m.hidden.cfg, "ssid", wssid:formvalue(section))
- if s.encryption and s.key then
- uci:set("wireless", m.hidden.cfg, "key", wkey:formvalue(section))
- elseif s.encryption and s.password then
- uci:set("wireless", m.hidden.cfg, "password", wkey:formvalue(section))
+ uci:set("wireless", m.hidden.cfg, "bssid", bssid:formvalue(section))
+ if s.identity then
+ val = ident:formvalue(section)
+ if val == "" then
+ val = "changeme"
+ end
+ uci:set("wireless", m.hidden.cfg, "identity", val)
+ end
+
+ if s.encryption and s.encryption ~= "none" then
+ val = wkey:formvalue(section)
+ if val == "" then
+ val = "changeme"
+ end
+ if s.key then
+ uci:set("wireless", m.hidden.cfg, "key", val)
+ elseif s.password then
+ uci:set("wireless", m.hidden.cfg, "password", val)
+ end
end
uci:save("wireless")
uci:commit("wireless")