diff options
author | Steven Barth <steven@midlink.org> | 2008-06-29 14:42:53 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-06-29 14:42:53 +0000 |
commit | ee324cb3a70d39dc9522a1ee63af12137d433533 (patch) | |
tree | 564544d3e6bff5e916d77a427bba6b1536ba7c94 /applications/luci-splash/luasrc/controller | |
parent | 4c7df626b2a27e9bea4793c96929de17f38e7bd2 (diff) |
* applications/luci-splash: Rewrote luci-splash using an own daemon implementation
* Minor tweaks in luci.dispatcher
Diffstat (limited to 'applications/luci-splash/luasrc/controller')
-rw-r--r-- | applications/luci-splash/luasrc/controller/splash/splash.lua | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/applications/luci-splash/luasrc/controller/splash/splash.lua b/applications/luci-splash/luasrc/controller/splash/splash.lua index 617e0f877..6512ee5b1 100644 --- a/applications/luci-splash/luasrc/controller/splash/splash.lua +++ b/applications/luci-splash/luasrc/controller/splash/splash.lua @@ -1,16 +1,23 @@ module("luci.controller.splash.splash", package.seeall) function index() - local page = node("admin", "services", "splash") - page.target = cbi("splash/splash") - page.title = "Client-Splash" + entry({"admin", "services", "splash"}, cbi("splash/splash"), "Client-Splash") + node("splash").target = call("action_dispatch") node("splash", "splash", "activate").target = call("action_activate") - node("splash", "splash", "allowed").target = call("action_allowed") - node("splash", "splash", "unknown").target = call("action_unknown") node("splash", "splash", "splash").target = template("splash_splash/splash") end +function action_dispatch() + local mac = luci.sys.net.ip4mac(luci.http.getenv("REMOTE_ADDR")) + local status = luci.sys.execl("luci-splash status "..mac)[1] + if status == "whitelisted" or status == "lease" then + luci.http.redirect(luci.dispatcher.build_url()) + else + luci.http.redirect(luci.dispatcher.build_url("splash", "splash", "splash")) + end +end + function action_activate() local mac = luci.sys.net.ip4mac(luci.http.getenv("REMOTE_ADDR")) if mac and luci.http.formvalue("accept") then @@ -19,12 +26,4 @@ function action_activate() else luci.http.redirect(luci.dispatcher.build_url()) end -end - -function action_allowed() - luci.http.redirect(luci.dispatcher.build_url()) -end - -function action_unknown() - luci.http.redirect(luci.dispatcher.build_url()) end
\ No newline at end of file |