From 4d69d93c131b3dfd0e3c321da67e62ab44e42293 Mon Sep 17 00:00:00 2001 From: Nathan Angelacos Date: Wed, 14 Nov 2007 22:08:31 +0000 Subject: Session cookie gets written, session table gets stored (working) git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@305 ab2d0c66-481e-0410-8bed-d214d4d58bed --- app/acf_www-controller.lua | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'app/acf_www-controller.lua') diff --git a/app/acf_www-controller.lua b/app/acf_www-controller.lua index ef52bc2..97fb6bb 100644 --- a/app/acf_www-controller.lua +++ b/app/acf_www-controller.lua @@ -33,28 +33,34 @@ mvc.on_load = function (self, parent) local session=require ("session") self.session = {} + local tempid = "" if self.clientdata.sessionid == nil then - self.session.id = session.random_hash(512) - end - local timestamp - timestamp, self.session = session.load_session(self.conf.sessiondir, - self.clientdata.sessionid) - if timestamp == nil then - -- FIXME ... need to add this function - -- record an invalid sessionid event + self.session.id = session.random_hash(512) + tempid = self.session.id else - --[[ - FIXME --- need to write this function - if too many bad events for this ip invaidate the session + tempid = self.session.id + + local timestamp + timestamp, self.session = session.load_session(self.conf.sessiondir, + self.clientdata.sessionid) + if timestamp == nil then + -- FIXME ... need to add this function + -- record an invalid sessionid event + self.session.id = tempid + else + --[[ + FIXME --- need to write this function + if too many bad events for this ip invaidate the session - if (timestamp is > 10 minutes old) - session.unlink.session (self.conf.sessiondir, - self.session.id) - self.session = {} - self.session.id = session.random_hash(512) - generate flash message "Inactivity logout" + if (timestamp is > 10 minutes old) + session.unlink.session (self.conf.sessiondir, + self.session.id) + self.session = {} + self.session.id = session.random_hash(512) + generate flash message "Inactivity logout" + end + ]]-- end - ]]-- end end -- cgit v1.2.3