diff options
-rw-r--r-- | app/acf-util/logon-controller.lua | 5 | ||||
-rw-r--r-- | app/acf-util/logon-html.lsp | 7 | ||||
-rw-r--r-- | app/acf_www-controller.lua | 16 |
3 files changed, 16 insertions, 12 deletions
diff --git a/app/acf-util/logon-controller.lua b/app/acf-util/logon-controller.lua index e909fb9..978ee8c 100644 --- a/app/acf-util/logon-controller.lua +++ b/app/acf-util/logon-controller.lua @@ -8,7 +8,8 @@ default_action = "status" logon = function(self) local userid = cfe({ value=clientdata.userid or "", label="User ID" }) local password = cfe({ label="Password" }) - local cmdresult = cfe({ type="form", value={userid=userid, password=password}, label="Logon", option="Logon" }) + local redir = cfe({ value=clientdata.redir or "/welcome/read", label="" }) + local cmdresult = cfe({ type="form", value={userid=userid, password=password, redir=redir}, label="Logon", option="Logon" }) if clientdata.Logon then local logon = self.model:logon(clientdata.userid, clientdata.password, conf.clientip, conf.sessiondir, sessiondata) -- If successful logon, redirect to welcome-page, otherwise try again @@ -19,7 +20,7 @@ logon = function(self) end cmdresult = self:redirect_to_referrer(cmdresult) if logon.value then - redirect(self, "/welcome/read") + redirect(self, cmdresult.value.redir.value) end else cmdresult = self:redirect_to_referrer() or cmdresult diff --git a/app/acf-util/logon-html.lsp b/app/acf-util/logon-html.lsp index 3d131bc..f6137cf 100644 --- a/app/acf-util/logon-html.lsp +++ b/app/acf-util/logon-html.lsp @@ -6,7 +6,8 @@ <h1><%= form.label %></h1> <% - form.value.password.type = "password" - local order = { "userid", "password" } - displayform(form, order) + form.value.password.type = "password" + form.value.redir.type = "hidden" + local order = { "userid", "password" } + displayform(form, order) %> diff --git a/app/acf_www-controller.lua b/app/acf_www-controller.lua index b00953e..dad0026 100644 --- a/app/acf_www-controller.lua +++ b/app/acf_www-controller.lua @@ -287,9 +287,14 @@ exception_handler = function (self, message ) local html = require ("html") local viewtable if type(message) == "table" then - if message.type == "redir" and self.conf.component == true then + if self.conf.component == true then io.write ("Component cannot be found") - elseif message.type == "redir" or message.type == "redir_to_referrer" then + elseif message.type == "dispatch" and self.sessiondata.userinfo and self.sessiondata.userinfo.userid then + viewtable = message + self.conf.prefix = "/" + self.conf.controller = "dispatcherror" + self.conf.action = "" + elseif message.type == "redir" or message.type == "redir_to_referrer" or message.type == "dispatch" then --if self.sessiondata.id then logevent("Redirecting " .. self.sessiondata.id) end io.write ("Status: 302 Moved\n") if message.type == "redir" then @@ -297,6 +302,8 @@ exception_handler = function (self, message ) message.prefix .. message.controller .. "/" .. message.action .. (message.extra or "" ) .. "\n") + elseif message.type == "dispatch" then + io.write ("Location: " .. ENV["SCRIPT_NAME"] .. "/acf-util/logon/logon?redir="..message.prefix..message.controller.."/"..message.action.."\n") else io.write ("Location: " .. ENV.HTTP_REFERER .. "\n") end @@ -306,11 +313,6 @@ exception_handler = function (self, message ) io.write (html.cookie.unset("sessionid")) end io.write ( "Content-Type: text/html\n\n" ) - elseif message.type == "dispatch" then - viewtable = message - self.conf.prefix = "/" - self.conf.controller = "dispatcherror" - self.conf.action = "" else parent_exception_handler(self, message) end |