summaryrefslogtreecommitdiffstats
path: root/app/acf-util/logon-controller.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2010-09-28 07:15:36 +0000
committerTed Trask <ttrask01@yahoo.com>2010-09-28 07:15:36 +0000
commitb202af98292d6d7b5053e5a934b916153ce89af9 (patch)
treebd8a6e2a973d01317fbf462e13d98932fbed2822 /app/acf-util/logon-controller.lua
parent09344bc273f7147a9f81168096d2f8bb3d0fdedc (diff)
downloadacf-core-b202af98292d6d7b5053e5a934b916153ce89af9.tar.bz2
acf-core-b202af98292d6d7b5053e5a934b916153ce89af9.tar.xz
Made major changes to authenticator and roles to improve efficiency.
Changed authenticator.lua to request individual users, rather than always loading everyone. Modified get_userinfo and removed get_userinfo_roles and get_userinfo_skin to remove unnecessary cfe processing. This was especially bad when retrieving the cfe options for skins and roles. This does break the interface used by other modules like acf-tinydns. Validation and cfe processing were moved into password-model, where they belong. Added global variables to authenticator and roles libraries so they can reuse data that was already generated. Modified logon-controller to only check for zero users if logon fails.
Diffstat (limited to 'app/acf-util/logon-controller.lua')
-rw-r--r--app/acf-util/logon-controller.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/app/acf-util/logon-controller.lua b/app/acf-util/logon-controller.lua
index 165bedb..2a88528 100644
--- a/app/acf-util/logon-controller.lua
+++ b/app/acf-util/logon-controller.lua
@@ -5,7 +5,7 @@ module (..., package.seeall)
default_action = "status"
-- Logon a new user based upon id and password in clientdata
-logon = function(self)
+local check_users = function(self)
-- If there are no users defined, add privileges and dispatch password/newuser
local users = self.model:list_users()
if #users.value == 0 then
@@ -14,9 +14,14 @@ logon = function(self)
self:dispatch(self.conf.prefix, "password", "newuser")
self.sessiondata.permissions[self.conf.prefix].password = nil
self.conf.suppress_view = true
- return
+ return true
end
+ return false
+end
+
+-- Logon a new user based upon id and password in clientdata
+logon = function(self)
local userid = cfe({ value=clientdata.userid or "", label="User ID" })
local password = cfe({ label="Password" })
local redir = cfe({ value=clientdata.redir or "welcome/read", label="" })
@@ -28,6 +33,7 @@ logon = function(self)
if logon.value then
cmdresult.descr = "Logon Successful"
else
+ if check_users(self) then return end
cmdresult.errtxt = "Logon Attempt Failed"
end
cmdresult = self:redirect_to_referrer(cmdresult)
@@ -42,6 +48,7 @@ logon = function(self)
redirect(self, cmdresult.value.redir.value)
end
else
+ if check_users(self) then return end
cmdresult = self:redirect_to_referrer() or cmdresult
end
return cmdresult