From 40ea307aa34120de1409050525140831ce8634d8 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Mon, 28 Apr 2008 13:04:04 +0000 Subject: Added cfe support to logon git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1049 ab2d0c66-481e-0410-8bed-d214d4d58bed --- app/acf-util/logon-controller.lua | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'app/acf-util/logon-controller.lua') 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 -- cgit v1.2.3