From 1197c8530638be7e8123301f47ca863cd9598338 Mon Sep 17 00:00:00 2001 From: Nathan Angelacos Date: Sun, 9 Dec 2007 18:07:00 +0000 Subject: added logevent function (hardcoded to write to /var/log/acf.log) git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@421 ab2d0c66-481e-0410-8bed-d214d4d58bed --- app/acf-util/logon-controller.lua | 32 ++++++++++++++------------------ app/acf-util/logon-model.lua | 2 +- 2 files changed, 15 insertions(+), 19 deletions(-) (limited to 'app/acf-util') diff --git a/app/acf-util/logon-controller.lua b/app/acf-util/logon-controller.lua index 18e4e0f..c0fa8b9 100644 --- a/app/acf-util/logon-controller.lua +++ b/app/acf-util/logon-controller.lua @@ -29,27 +29,23 @@ logon = function(self) userid.errtxt = "There was a problem logging in" else -- the login was successful - give them a new session, and redir to logged in - session.id = session.random_hash ( 512) - session.userinfo = self.model.get_userinfo (userid) - self.conf.controller="welcome" - self.conf.action = "" - self.conf.type = "redir" - error (self.conf) + session.id = session.random_hash ( 512) + session.userinfo = self.model.get_userinfo (userid) + self.conf.controller="welcome" + self.conf.action = "" + self.conf.type = "redir" + logevent ("Logon was successful for " .. session.userinfo.username) + error (self.conf) end else - self.conf.controller = "" - self.conf.action = "" - self.conf.prefix = "" - self.conf.type = "redir" - error(self.conf) - end -- If we reach this point, just give them the login page - return ( cfe ({type="form", - option={ script=ENV["SCRIPT_NAME"], - prefix=self.conf.prefix, - controller = self.conf.controller, - action = "logon" }, - value = { userid, password, logon } })) + return ( cfe ({type="form", + option={ script=ENV["SCRIPT_NAME"], + prefix=self.conf.prefix, + controller = self.conf.controller, + action = "logon" }, + value = { userid, password, logon } })) + end end diff --git a/app/acf-util/logon-model.lua b/app/acf-util/logon-model.lua index 48b3cf2..dac48cd 100644 --- a/app/acf-util/logon-model.lua +++ b/app/acf-util/logon-model.lua @@ -26,7 +26,7 @@ logon = function (self, id, password ) -- record event and ignore the attempt -- All ok? -- look up their role, issue new session - return auth.authenticate (id, password) + return auth.authenticate (self, id, password) end logoff = function (self, sessionid) -- cgit v1.2.3