summaryrefslogtreecommitdiffstats
path: root/app/acf-util/logon-model.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2013-10-17 18:59:27 +0000
committerTed Trask <ttrask01@yahoo.com>2013-10-17 18:59:27 +0000
commitc0e0377e384c8167172ee06d8c11ef2f782522c7 (patch)
treebb89301e467ff61d93a39642354bcfe382571529 /app/acf-util/logon-model.lua
parentfcaab1b363fcd5ff2dccce8f98cacabc5635ba5f (diff)
downloadacf-core-c0e0377e384c8167172ee06d8c11ef2f782522c7.tar.bz2
acf-core-c0e0377e384c8167172ee06d8c11ef2f782522c7.tar.xz
Remove all calls to 'module' in preparation for move to Lua 5.2
Use mymodule parameter for module definition. This was also helpfule in revealing places where the code relied on the global environment.
Diffstat (limited to 'app/acf-util/logon-model.lua')
-rw-r--r--app/acf-util/logon-model.lua12
1 files changed, 7 insertions, 5 deletions
diff --git a/app/acf-util/logon-model.lua b/app/acf-util/logon-model.lua
index fd67ec2..279e988 100644
--- a/app/acf-util/logon-model.lua
+++ b/app/acf-util/logon-model.lua
@@ -1,6 +1,6 @@
-- Logon / Logoff model functions
-module (..., package.seeall)
+local mymodule = {}
session = require ("session")
html = require ("acf.html")
@@ -9,7 +9,7 @@ roles = require ("roles")
authenticator = require ("authenticator")
-- Logoff the user by deleting session data
-logoff = function (sessiondir, sessiondata)
+mymodule.logoff = function (sessiondir, sessiondata)
-- Unlink / delete the current session
local result = session.unlink_session(sessiondir, sessiondata.id)
local success = (result ~= nil)
@@ -23,7 +23,7 @@ end
-- Log on new user if possible and set up userinfo in session
-- if we fail, we leave the session alone (don't log off)
-logon = function (self, userid, password, ip_addr, sessiondir, sessiondata)
+mymodule.logon = function (self, userid, password, ip_addr, sessiondir, sessiondata)
-- Check to see if we can log on this user id / ip addr
local countevent = session.count_events(sessiondir, userid, session.hash_ip_addr(ip_addr), self.conf.lockouttime, self.conf.lockouteventlimit)
if countevent then
@@ -34,7 +34,7 @@ logon = function (self, userid, password, ip_addr, sessiondir, sessiondata)
if authenticator.authenticate (self, userid, password) then
-- We have a successful logon, change sessiondata
-- for some reason, can't call this function or it skips rest of logon
- -- logoff(sessiondir, sessiondata)
+ -- mymodule.logoff(sessiondir, sessiondata)
---[[ so, do this instead
session.unlink_session(sessiondir, sessiondata.id)
-- Clear the current session data
@@ -57,6 +57,8 @@ logon = function (self, userid, password, ip_addr, sessiondir, sessiondata)
return cfe({ type="boolean", value=false, label="Logon Success" })
end
-list_users = function(self)
+mymodule.list_users = function(self)
return cfe({ type="list", value=authenticator.list_users(self), label="Users" })
end
+
+return mymodule