libs/sys: properly handle passwords with apostrophes
[project/luci.git] / applications / luci-ffwizard / luasrc / model / cbi / ffwizard.lua
index 0cc26e5928a105f58fca142fd73c06ec8a4fbaa1..47118d19b7a4a73a7c58d2ebb54839bb42bf267e 100644 (file)
@@ -121,9 +121,7 @@ function hostname.write(self, section, value)
        uci:save("freifunk")
 end
 function hostname.validate(self, value)
-       if (#value > 16) then
-               return
-       elseif (string.find(value, "[^%w%_%-]")) then
+       if (#value > 24) or string.find(value, "[^%w%.%-]") or string.find(string.sub(value, value:len()), "[%.%-]") or string.find(string.sub(value, 1), "[%.%-]") then
                return
        else
                return value
@@ -604,9 +602,9 @@ function f.handle(self, state, data)
                        if has_radvd then
                                uci:commit("radvd")
                        end
--- the following line didn't work without admin-mini, for now i just replaced it with sys.exec... soma
---                     luci.http.redirect(luci.dispatcher.build_url(unpack(luci.dispatcher.context.requested.path), "system", "reboot") .. "?reboot=1")
-                       sys.exec("reboot")
+
+                       sys.exec("for s in network dnsmasq luci_splash firewall uhttpd olsrd radvd l2gvpn; do [ -x /etc/init.d/$s ] && /etc/init.d/$s restart;done > /dev/null &")
+                       luci.http.redirect(luci.dispatcher.build_url(luci.dispatcher.context.path[1], "freifunk", "ffwizard"))
                end
                return false
        elseif state == FORM_INVALID then