diff options
Diffstat (limited to 'app/acf-util/logon-controller.lua')
-rw-r--r-- | app/acf-util/logon-controller.lua | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/app/acf-util/logon-controller.lua b/app/acf-util/logon-controller.lua index 3661320..e10874e 100644 --- a/app/acf-util/logon-controller.lua +++ b/app/acf-util/logon-controller.lua @@ -2,40 +2,38 @@ module (..., package.seeall) -require ("session") - -mvc.on_load = function(self, parent) - -- If they specify an invalid action or try to run init, then redirect - -- to the read function. - if ( self.conf.action == nil or self.conf.action == "init" ) then - -- do what? - end +--require ("session") -end - +mvc.on_load = function(self, parent) + if (self.worker[self.conf.action] == nil ) or ( self.conf.action == "init" ) then + self.worker[self.conf.action] = list_redir(self) + end + --logit ("logon.mvc.on_load activated") + end logon = function(self) +--return ( {logon=self.model:logon(self,clientdata.userid, clientdata.password) }) - local userid=cfe({ name="userid" }) - local password=cfe({ name="password" }) - local logon=cfe({ name="Logon", type="submit"}) - local s = "" +local userid=cfe({ name="userid" }) +local password=cfe({ name="password" }) +local logon=cfe({ name="Logon", type="submit"}) +local s = "" -- FIXME - if they are already logged in, log out first if clientdata.userid and clientdata.password then - local t = self.model.logon(self,clientdata.userid,clientdata.password) + local t = self.model.logon(self,clientdata.userid,clientdata.password) if t == nil then - userid.value = self.clientdata.userid + userid.value = self.clientdata.userid userid.errtxt = "There was a problem logging in" else -- the login was successful - give them a new session, and redir to logged in sessiondata.id = session.random_hash ( 512) sessiondata.userinfo = t or {} - self.conf.prefix="/" - self.conf.controller="welcome" - self.conf.action = "read" + self.conf.prefix="/acf-util/" + self.conf.controller="logon" + self.conf.action = "status" self.conf.type = "redir" error (self.conf) end @@ -51,13 +49,9 @@ end logout = function(self) - self.model.logout(self, session.id) - + return { logout = self.model:logoff(clientdata.sessionid) } +end - -- and raise an error to go to the homepage - self.conf.action = "" - self.conf.prefix = "" - self.conf.controller = "" - self.conf.type = "redir" - error(self.conf) +status = function(self) + return( {stats= self.model:status(clientdata.sessionid) }) end |