summaryrefslogtreecommitdiffstats
path: root/app/acf-util/logon-controller.lua
diff options
context:
space:
mode:
Diffstat (limited to 'app/acf-util/logon-controller.lua')
-rw-r--r--app/acf-util/logon-controller.lua23
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