From 8cfe28d0691856222685b93f4a58664416a0aa65 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Tue, 22 Jul 2008 19:58:39 +0000 Subject: Split common code out of authenticator-plaintext into authenticator.lua in preparation for adding SQL authentication. Rewrote authentication functions to use cfe's. Made corresponding changes to roles and logon. Added dnsfiles field to userdata for tinydns access control. git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1314 ab2d0c66-481e-0410-8bed-d214d4d58bed --- app/acf-util/logon-model.lua | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'app/acf-util/logon-model.lua') diff --git a/app/acf-util/logon-model.lua b/app/acf-util/logon-model.lua index 3644a09..b817cf9 100644 --- a/app/acf-util/logon-model.lua +++ b/app/acf-util/logon-model.lua @@ -6,18 +6,7 @@ require ("session") require ("html") require ("fs") require ("roles") - ---varibles for time in case of logons,expired,lockouts - --- load an authenticator --- FIXME: use an "always true" as default? - -local auth -if authenticator then - auth = require ("authenticator-" .. conf.authenticator) -else - auth = require ("authenticator-plaintext") -end +require ("authenticator") -- Logoff the user by deleting session data logoff = function (sessiondir, sessiondata) @@ -42,7 +31,7 @@ logon = function (self, userid, password, ip_addr, sessiondir, sessiondata) end if false == countevent and userid and password then - if auth.authenticate (self, userid, password) then + if authenticator.authenticate (self, userid, password) then -- We have a successful login, change sessiondata -- for some reason, can't call this function or it skips rest of logon -- logout(sessiondir, sessiondata) @@ -54,8 +43,11 @@ logon = function (self, userid, password, ip_addr, sessiondir, sessiondata) end --]] sessiondata.id = session.random_hash(512) - local t = auth.get_userinfo (self, userid) - sessiondata.userinfo = t or {} + local t = authenticator.get_userinfo (self, userid) + sessiondata.userinfo = {} + for name,value in pairs(t.value) do + sessiondata.userinfo[name] = value.value + end return cfe({ type="boolean", value=true, label="Logon Success" }) else -- We have a bad login, log the event -- cgit v1.2.3