summaryrefslogtreecommitdiffstats
path: root/lib/session.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2010-03-10 14:49:39 +0000
committerTed Trask <ttrask01@yahoo.com>2010-03-10 14:49:39 +0000
commitb432c381028ed2db46a2c960b57db9efbc220093 (patch)
treed616021d0491dd49eea351ab1a093021a3c23f19 /lib/session.lua
parent762b02aad14e43aaabf6705099e2a878058cd6cd (diff)
downloadacf-core-b432c381028ed2db46a2c960b57db9efbc220093.tar.bz2
acf-core-b432c381028ed2db46a2c960b57db9efbc220093.tar.xz
Added sessiontimeout, lockouttime, and lockouteventlimit parameters to acf.conf.
Diffstat (limited to 'lib/session.lua')
-rw-r--r--lib/session.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/session.lua b/lib/session.lua
index f84551e..f55f2bf 100644
--- a/lib/session.lua
+++ b/lib/session.lua
@@ -195,10 +195,10 @@ end
-- Check how many invalid login events
-- have happened for this id in the last n minutes
-- this will only effect the lockevent files
-count_events = function (sessionpath, id_user, ipaddr)
+count_events = function (sessionpath, id_user, ipaddr, minutes, limit)
--we need to have the counts added up? deny off any and or all
local now = os.time()
- local minutes_ago = now - (minutes_count_events * 60)
+ local minutes_ago = now - ((minutes or minutes_count_events) * 60)
local t = {}
--give me all lockevents then we will sort through them
local searchfor = sessionpath .. "/lockevent.*"
@@ -215,7 +215,7 @@ count_events = function (sessionpath, id_user, ipaddr)
end
end
end
- if count>limit_count_events then
+ if count>(tonumber(limit) or limit_count_events) then
return true
else
return false
@@ -224,11 +224,11 @@ count_events = function (sessionpath, id_user, ipaddr)
end
-- Clear events that are older than n minutes
-expired_events = function (sessionpath)
+expired_events = function (sessionpath, minutes)
--current os time in seconds
local now = os.time()
--take minutes and convert to seconds
- local minutes_ago = now - (minutes_expired_events * 60)
+ local minutes_ago = now - ((minutes or minutes_expired_events) * 60)
local searchfor = sessionpath .. "/lockevent.*"
--first do the lockevent files
local temp = posix.glob(searchfor)