From: Jo-Philipp Wich Date: Tue, 6 Oct 2015 23:54:56 +0000 (+0200) Subject: luci-mod-admin-full: switch to POST action for reboot X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=38a9993bd1bf0024639e19a9c25328a9d5d5954e;p=oweals%2Fluci.git luci-mod-admin-full: switch to POST action for reboot Also rework the reboot tmeplate a little bit. Signed-off-by: Jo-Philipp Wich --- diff --git a/modules/luci-mod-admin-full/luasrc/controller/admin/system.lua b/modules/luci-mod-admin-full/luasrc/controller/admin/system.lua index 1b38c6783..64af555e7 100644 --- a/modules/luci-mod-admin-full/luasrc/controller/admin/system.lua +++ b/modules/luci-mod-admin-full/luasrc/controller/admin/system.lua @@ -34,7 +34,8 @@ function index() entry({"admin", "system", "flashops"}, call("action_flashops"), _("Backup / Flash Firmware"), 70) entry({"admin", "system", "flashops", "backupfiles"}, form("admin_system/backupfiles")) - entry({"admin", "system", "reboot"}, call("action_reboot"), _("Reboot"), 90) + entry({"admin", "system", "reboot"}, template("admin_system/reboot"), _("Reboot"), 90) + entry({"admin", "system", "reboot", "call"}, post("action_reboot")) end function action_clock_status() @@ -316,11 +317,7 @@ function action_passwd() end function action_reboot() - local reboot = luci.http.formvalue("reboot") - luci.template.render("admin_system/reboot", {reboot=reboot}) - if reboot then - luci.sys.reboot() - end + luci.sys.reboot() end function fork_exec(command) diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/reboot.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/reboot.htm index aa7441d13..c9551804d 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_system/reboot.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_system/reboot.htm @@ -1,25 +1,59 @@ <%# Copyright 2008 Steven Barth - Copyright 2008 Jo-Philipp Wich + Copyright 2008-2015 Jo-Philipp Wich Licensed to the public under the Apache License 2.0. -%> <%+header%> -

<%:System%>

-

<%:Reboot%>

+ +

<%:Reboot%>

+
+

<%:Reboots the operating system of your device%>

-<%- -local c = require("luci.model.uci").cursor():changes() -if c and next(c) then --%> -

<%:Warning: There are unsaved changes that will be lost while rebooting!%>

-<%- -end -if not reboot then --%> -

<%:Perform reboot%>

-<%- else -%> -

<%:Please wait: Device rebooting...%>

- + +<%- local c = require("luci.model.uci").cursor():changes(); if c and next(c) then -%> +

<%:Warning: There are unsaved changes that will get lost on reboot!%>

<%- end -%> -<%+footer%> \ No newline at end of file + +
+ + + + + + + +<%+footer%>