diff options
author | Ted Trask <ttrask01@yahoo.com> | 2008-04-28 13:04:04 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2008-04-28 13:04:04 +0000 |
commit | 40ea307aa34120de1409050525140831ce8634d8 (patch) | |
tree | 898ec3eecc13aada3580a1ae7ace70fedecfc5ab /app/acf-util/logon-controller.lua | |
parent | 0fc3f415148c28ab02e5defbd6fa19524258e4cf (diff) | |
download | acf-core-40ea307aa34120de1409050525140831ce8634d8.tar.bz2 acf-core-40ea307aa34120de1409050525140831ce8634d8.tar.xz |
Added cfe support to logon
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1049 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'app/acf-util/logon-controller.lua')
-rw-r--r-- | app/acf-util/logon-controller.lua | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/app/acf-util/logon-controller.lua b/app/acf-util/logon-controller.lua index 8dddb87..7d4447b 100644 --- a/app/acf-util/logon-controller.lua +++ b/app/acf-util/logon-controller.lua @@ -6,31 +6,32 @@ default_action = "status" -- Logon a new user based upon id and password in clientdata logon = function(self) - local cmdresult + local cmdresult = cfe({ value=clientdata.userid or "", name="User ID" }) if clientdata.userid and clientdata.password then local logon = self.model:logon(clientdata, conf.clientip, conf.sessiondir, sessiondata) -- If successful logon, redirect to status, otherwise try again - if logon then - self.conf.action = "status" - self.conf.type = "redir" - error(self.conf) + if logon.value then + redirect(self, "status") else - cmdresult = "Logon Attempt Failed" + cmdresult.errtxt = "Logon Attempt Failed" end end - return ({ cmdresult = cmdresult }) + return cmdresult end -- Log out current user and go to login screen logout = function(self) local logout = self.model.logoff(conf.sessiondir, sessiondata) -- We have to redirect so a new session / menu is created - self.conf.action = "logon" - self.conf.type = "redir" - error (self.conf) + redirect(self, "logon") end -- Report the login status status = function(self) - return self.model.status(sessiondata) + local name = cfe({ name="User Name" }) + local sessionid = cfe({ value=self.sessiondata.id or "", name="Session ID" }) + if self.sessiondata.userinfo then + name.value = self.sessiondata.userinfo.username or "" + end + return cfe({ type="group", value={username=name, sessionid=sessionid} }) end |