[luci] Login form and default module

Bryan Mayland bmayland at leoninedev.com
Wed Jul 20 15:26:04 CEST 2011


The Administration pages gets their security because they are subnodes 
of the "admin" top level node which in controller/admin/index.lua sets 
the node's sysauth = "root" meaning you need to be logged in as root to 
see it.

The login page always takes you to where you were going.  So to make it 
go to your page after you log in, you need to be going to your page 
before the login page is shown.  The easiest way I found to do this is 
to add a second node that just bounces back to the first.  Set the 
second node to have a sysauth it will require a login then bounce the 
user back to to your other page, except now while logged in:

entry({"myApp"}, template("myApp/overview"), "myApp", 1).dependent=false
local page = entry({"myApp", "login"}, call("myApp_redirect"))
page.sysauth = "root"
page.sysauth_authenticator = "htmlauth"

function myApp_redirect()
     luci.http.redirect(luci.dispatcher.build_url("myApp")
end


More information about the luci mailing list