diff options
author | Nathan Angelacos <nangel@tetrasec.net> | 2007-12-09 18:18:41 +0000 |
---|---|---|
committer | Nathan Angelacos <nangel@tetrasec.net> | 2007-12-09 18:18:41 +0000 |
commit | c2dcd9a6e48e4d92d3f4c16ca5c1ae1d519b40b5 (patch) | |
tree | 5ab141304ebbb6cfd880e444441ee301135f1ba9 | |
parent | 1197c8530638be7e8123301f47ca863cd9598338 (diff) | |
download | acf-core-c2dcd9a6e48e4d92d3f4c16ca5c1ae1d519b40b5.tar.bz2 acf-core-c2dcd9a6e48e4d92d3f4c16ca5c1ae1d519b40b5.tar.xz |
WIP
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@422 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r-- | app/acf-util/logon-controller.lua | 8 | ||||
-rw-r--r-- | app/acf-util/logon-model.lua | 6 | ||||
-rw-r--r-- | lib/authenticator-plaintext.lua | 6 |
3 files changed, 13 insertions, 7 deletions
diff --git a/app/acf-util/logon-controller.lua b/app/acf-util/logon-controller.lua index c0fa8b9..f641d33 100644 --- a/app/acf-util/logon-controller.lua +++ b/app/acf-util/logon-controller.lua @@ -24,17 +24,19 @@ logon = function(self) -- FIXME - if they are already logged in, log out first if clientdata.userid and clientdata.password then - if self.model.logon(self, clientdata.userid, clientdata.password) == false then + local t = self.model.logon(self,clientdata.userid,clientdata.password) + + if t == nil then userid.value = self.clientdata.userid 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) + session.userinfo = t or {} self.conf.controller="welcome" self.conf.action = "" self.conf.type = "redir" - logevent ("Logon was successful for " .. session.userinfo.username) + logevent ("Logon was successful for " .. session.userinfo.username or "" ) error (self.conf) end else diff --git a/app/acf-util/logon-model.lua b/app/acf-util/logon-model.lua index dac48cd..6e8384d 100644 --- a/app/acf-util/logon-model.lua +++ b/app/acf-util/logon-model.lua @@ -26,7 +26,11 @@ logon = function (self, id, password ) -- record event and ignore the attempt -- All ok? -- look up their role, issue new session - return auth.authenticate (self, id, password) + if auth.authenticate (self, id, password) then + return auth.get_userinfo (self, id) + else + return false + end end logoff = function (self, sessionid) diff --git a/lib/authenticator-plaintext.lua b/lib/authenticator-plaintext.lua index d18f5bb..21b3a48 100644 --- a/lib/authenticator-plaintext.lua +++ b/lib/authenticator-plaintext.lua @@ -42,7 +42,7 @@ pvt.parse_authfile = function(filename) end return row else - return false + return nil end end @@ -82,10 +82,10 @@ authenticate = function ( self, userid, password ) -- This function returns the username and roles -- or false on an error -userinfo = function ( self, userid ) +get_userinfo = function ( self, userid ) local t = pvt.parse_authfile(self.conf.confdir .. "/passwd") if t == false then - return false + return nil else pvt.get_id (userid, t) end |