summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-ffwizard/luasrc/model/cbi
diff options
context:
space:
mode:
authorManuel Munz <freifunk@somakoma.de>2011-01-20 00:34:48 +0000
committerManuel Munz <freifunk@somakoma.de>2011-01-20 00:34:48 +0000
commit7a5b6e34af277fe7c532830f7b2bae46b6af076d (patch)
tree4ace6fbcd98384a11c07269446f23e84181e5951 /applications/luci-ffwizard/luasrc/model/cbi
parent1805fb7b14dde735cf1938f5a536b32a0efab82f (diff)
applications/ffwizard: Show password field only when it is the default (as in /rom/etc/passwd)
Diffstat (limited to 'applications/luci-ffwizard/luasrc/model/cbi')
-rw-r--r--applications/luci-ffwizard/luasrc/model/cbi/ffwizard.lua38
1 files changed, 12 insertions, 26 deletions
diff --git a/applications/luci-ffwizard/luasrc/model/cbi/ffwizard.lua b/applications/luci-ffwizard/luasrc/model/cbi/ffwizard.lua
index bc8bfd61cb..0cc26e5928 100644
--- a/applications/luci-ffwizard/luasrc/model/cbi/ffwizard.lua
+++ b/applications/luci-ffwizard/luasrc/model/cbi/ffwizard.lua
@@ -66,30 +66,20 @@ end
-------------------- View --------------------
f = SimpleForm("ffwizward", "Freifunkassistent",
"Dieser Assistent unterstützt Sie bei der Einrichtung des Routers für das Freifunknetz.")
--- main netconfig
-local newpsswd = has_rom and sys.exec("diff /rom/etc/passwd /etc/passwd")
-if newpsswd ~= "" then
- pw = f:field(Flag, "pw", "Router Passwort", "Setzen Sie den Haken, um Ihr Passwort zu ändern.")
- function pw.cfgvalue(self, section)
- return 1
- end
-end
-
-pw1 = f:field(Value, "pw1", translate("password"))
-pw1.password = true
-pw1.rmempty = false
-pw2 = f:field(Value, "pw2", translate("confirmation"))
-pw2.password = true
-pw2.rmempty = false
+-- if password is not set or default then force the user to set a new one
+if sys.exec("diff /rom/etc/passwd /etc/passwd") == "" then
+ pw1 = f:field(Value, "pw1", translate("password"))
+ pw1.password = true
+ pw1.rmempty = false
-function pw2.validate(self, value, section)
- return pw1:formvalue(section) == value and value
-end
+ pw2 = f:field(Value, "pw2", translate("confirmation"))
+ pw2.password = true
+ pw2.rmempty = false
-if newpsswd ~= "" then
- pw1:depends("pw", "1")
- pw2:depends("pw", "1")
+ function pw2.validate(self, value, section)
+ return pw1:formvalue(section) == value and value
+ end
end
net = f:field(ListValue, "net", "Freifunk Community", "Nutzen Sie die Einstellungen der Freifunk Gemeinschaft in ihrer Nachbarschaft.")
@@ -589,11 +579,7 @@ function f.handle(self, state, data)
else
if data.pw1 then
local stat = luci.sys.user.setpasswd("root", data.pw1) == 0
--- if stat then
--- f.message = translate("a_s_changepw_changed")
--- else
--- f.errmessage = translate("unknownerror")
- end
+ end
data.pw1 = nil
data.pw2 = nil
uci:commit("freifunk")