summaryrefslogtreecommitdiffstats
path: root/app/acf-util/logon-controller.lua
blob: 75915fca971ab1636dc72fd2c7aac626736a755b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
-- Logon / Logoff functions

module (..., package.seeall)

--require ("session")
	
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,clientdata.sessionid) })
end

logout = function(self)
	local logout = self.model:logoff(clientdata.sessionid)
	if (logout) and (logout[1]) and (logout[1]["value"]) and (string.lower(logout[1]["value"]) == "successful") then
		self.conf.action = "logon"
		self.conf.type = "redir"
		error (self.conf)
	end

	return  { logout = logout } 
end

status = function(self)
	return( {stats= self.model:status(clientdata.sessionid) })
end