diff options
Diffstat (limited to 'modules/luci-mod-system/luasrc')
4 files changed, 76 insertions, 2 deletions
diff --git a/modules/luci-mod-system/luasrc/controller/admin/system.lua b/modules/luci-mod-system/luasrc/controller/admin/system.lua index 3e58896d63..49d4476c4e 100644 --- a/modules/luci-mod-system/luasrc/controller/admin/system.lua +++ b/modules/luci-mod-system/luasrc/controller/admin/system.lua @@ -9,6 +9,7 @@ function index() entry({"admin", "system", "system"}, cbi("admin_system/system"), _("System"), 1) entry({"admin", "system", "clock_status"}, post_on({ set = true }, "action_clock_status")) + entry({"admin", "system", "ntp_restart"}, call("action_ntp_restart"), nil).leaf = true entry({"admin", "system", "admin"}, firstchild(), _("Administration"), 2) entry({"admin", "system", "admin", "password"}, template("admin_system/password"), _("Router Password"), 1) @@ -64,6 +65,14 @@ function action_clock_status() luci.http.write_json({ timestring = os.date("%c") }) end +function action_ntp_restart() + if nixio.fs.access("/etc/init.d/sysntpd") then + os.execute("/etc/init.d/sysntpd restart") + end + luci.http.prepare_content("text/plain") + luci.http.write("0") +end + local function image_supported(image) return (os.execute("sysupgrade -T %q >/dev/null" % image) == 0) end diff --git a/modules/luci-mod-system/luasrc/model/cbi/admin_system/system.lua b/modules/luci-mod-system/luasrc/model/cbi/admin_system/system.lua index c26fd475a4..33ec027e0d 100644 --- a/modules/luci-mod-system/luasrc/model/cbi/admin_system/system.lua +++ b/modules/luci-mod-system/luasrc/model/cbi/admin_system/system.lua @@ -22,6 +22,7 @@ s.addremove = false s:tab("general", translate("General Settings")) s:tab("logging", translate("Logging")) s:tab("language", translate("Language and Style")) +s:tab("advanced", translate("Advanced")) if has_zram then s:tab("zram", translate("ZRam Settings")) end -- @@ -66,7 +67,7 @@ end -- Logging -- -o = s:taboption("logging", Value, "log_size", translate("System log buffer size"), "kiB") +o = s:taboption("logging", Value, "log_size", translate("System log buffer size"), translate("KiB")) o.optional = true o.placeholder = 16 o.datatype = "uinteger" @@ -170,6 +171,28 @@ end -- +-- Advanced +-- + +o = s:taboption("advanced", Value, "_pollinterval", + translate("Polling interval"), + translate("Polling interval for status queries in seconds")) +o.datatype = "range(3, 20)" +o.default = 5 +o:value("3") +o:value("5") +o:value("10") + +function o.cfgvalue(...) + return m.uci:get("luci", "main", "pollinterval") +end + +function o.write(self, section, value) + m.uci:set("luci", "main", "pollinterval", value) +end + + +-- -- NTP -- diff --git a/modules/luci-mod-system/luasrc/view/admin_system/clock_status.htm b/modules/luci-mod-system/luasrc/view/admin_system/clock_status.htm index 2c96eb4180..796aa695c6 100644 --- a/modules/luci-mod-system/luasrc/view/admin_system/clock_status.htm +++ b/modules/luci-mod-system/luasrc/view/admin_system/clock_status.htm @@ -28,9 +28,29 @@ return false; } + + function btn_action(action) + { + if (action.name === "do_ntp_restart") + { + new XHR.get('<%=luci.dispatcher.build_url("admin", "system", "ntp_restart")%>', null, + function(x) + { + if (!x) + { + return; + } + }); + } + } + //]]></script> <span id="<%=self.option%>-clock-status"><em><%:Collecting data...%></em></span> <input type="button" class="cbi-button cbi-button-apply" value="<%:Sync with browser%>" onclick="return sync_clock(this)" /> +<% if require("nixio.fs").access("/etc/init.d/sysntpd") then %> +<input type="button" class="cbi-button cbi-button-apply" name="do_ntp_restart" value="<%:Sync with NTP-Server%>" onclick="btn_action(this)" /> +<% end %> + <%+cbi/valuefooter%> diff --git a/modules/luci-mod-system/luasrc/view/admin_system/password.htm b/modules/luci-mod-system/luasrc/view/admin_system/password.htm index 09cea4f74a..6ca02a83c1 100644 --- a/modules/luci-mod-system/luasrc/view/admin_system/password.htm +++ b/modules/luci-mod-system/luasrc/view/admin_system/password.htm @@ -2,6 +2,27 @@ <input type="password" aria-hidden="true" style="position:absolute; left:-10000px" /> +<script type="text/javascript"> +function checkPassword() { + var pw1 = document.body.querySelector('[name="pw1"]'); + var view = document.getElementById("passstrength"); + + var strongRegex = new RegExp("^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$", "g"); + var mediumRegex = new RegExp("^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$", "g"); + var enoughRegex = new RegExp("(?=.{6,}).*", "g"); + if (false == enoughRegex.test(pw1.value)) { + view.innerHTML = '<%:Password strength%>: <span style="color:red"><%:More Characters%></span>'; + } else if (strongRegex.test(pw1.value)) { + view.innerHTML = '<%:Password strength%>: <span style="color:green"><%:Strong%></span>'; + } else if (mediumRegex.test(pw1.value)) { + view.innerHTML = '<%:Password strength%>: <span style="color:orange"><%:Medium%></span>'; + } else { + view.innerHTML = '<%:Password strength%>: <span style="color:red"><%:Weak%></span>'; + } + return true; +} +</script> + <div class="cbi-map"> <h2><%:Router Password%></h2> @@ -13,7 +34,7 @@ <div class="cbi-value"> <label class="cbi-value-title" for="image"><%:Password%></label> <div class="cbi-value-field"> - <input type="password" name="pw1" /><!-- + <input type="password" name="pw1" onkeyup="checkPassword()"/><!-- --><button class="cbi-button cbi-button-neutral" title="<%:Reveal/hide password%>" aria-label="<%:Reveal/hide password%>" onclick="var e = this.previousElementSibling; e.type = (e.type === 'password') ? 'text' : 'password'">∗</button> </div> </div> @@ -23,6 +44,7 @@ <div class="cbi-value-field"> <input type="password" name="pw2" onkeydown="if (event.keyCode === 13) submitPassword(event)" /><!-- --><button class="cbi-button cbi-button-neutral" title="<%:Reveal/hide password%>" aria-label="<%:Reveal/hide password%>" onclick="var e = this.previousElementSibling; e.type = (e.type === 'password') ? 'text' : 'password'">∗</button> + <div id="passstrength" class="cbi-value-description"></div> </div> </div> </div> |