summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-07-23 12:29:46 +0000
committerTed Trask <ttrask01@yahoo.com>2008-07-23 12:29:46 +0000
commit178b4bec7aa886f08687a9518bc0f1a996fc7372 (patch)
tree72c30b448f521e20056162349d5eeb86d6012e67
parent8cfe28d0691856222685b93f4a58664416a0aa65 (diff)
downloadacf-core-178b4bec7aa886f08687a9518bc0f1a996fc7372.tar.bz2
acf-core-178b4bec7aa886f08687a9518bc0f1a996fc7372.tar.xz
Updated validator to make change_setting work.
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1315 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r--lib/authenticator.lua11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/authenticator.lua b/lib/authenticator.lua
index e6310ec..5d6bb98 100644
--- a/lib/authenticator.lua
+++ b/lib/authenticator.lua
@@ -53,8 +53,8 @@ local weak_password = function(password)
end
local write_settings = function(self, settings, id)
- load_auth()
- id = id or {}
+ load_database()
+ id = id or get_id(settings.value.userid.value) or {}
-- Password, password_confirm, roles, dnsfiles are allowed to not exist, just leave the same
id.userid = settings.value.userid.value
id.username = settings.value.username.value
@@ -197,7 +197,6 @@ list_users = function (self)
return output
end
--- UNTESTED
-- This function will change one user setting by name
-- Cannot be used for password or userid
change_setting = function (self, userid, parameter, value)
@@ -214,7 +213,7 @@ change_setting = function (self, userid, parameter, value)
-- Check if user entered available commands
if not value then
errtxt = "Invalid value"
- elseif not (pvt.availablefields(parameter)) then
+ elseif not (availablefields[parameter]) then
errtxt = "Invalid parameter"
elseif parameter == "userid" or parameter == "password" then
errtxt = "Cannot change "..parameter.." with this function"
@@ -225,7 +224,7 @@ change_setting = function (self, userid, parameter, value)
if not validate_settings(userinfo) then
errtxt = userinfo.value[parameter].errtxt
else
- success = write_settings(settings)
+ success = write_settings(self, userinfo)
end
end
@@ -273,7 +272,7 @@ new_settings = function (self, settings)
end
if success then
- success = write_settings(self, settings, id)
+ success = write_settings(self, settings)
end
if not success then