summaryrefslogtreecommitdiffstats
path: root/app/acf-util/password-controller.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-06-06 14:10:46 +0000
committerTed Trask <ttrask01@yahoo.com>2008-06-06 14:10:46 +0000
commit7344a5a7fbd434a160ba9ae28d8dfd709df79313 (patch)
tree445467b2db7dd4096cdfeeb9d0793e3c55f205a1 /app/acf-util/password-controller.lua
parentb696b28ec60c4386f452d36b6832b69324615dc9 (diff)
downloadacf-core-7344a5a7fbd434a160ba9ae28d8dfd709df79313.tar.bz2
acf-core-7344a5a7fbd434a160ba9ae28d8dfd709df79313.tar.xz
Moved clientdata processing from password model to controller.
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1208 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'app/acf-util/password-controller.lua')
-rwxr-xr-xapp/acf-util/password-controller.lua35
1 files changed, 23 insertions, 12 deletions
diff --git a/app/acf-util/password-controller.lua b/app/acf-util/password-controller.lua
index 4493e4a..9ad8e04 100755
--- a/app/acf-util/password-controller.lua
+++ b/app/acf-util/password-controller.lua
@@ -7,23 +7,27 @@ function status(self)
end
function editme(self)
- local output
+ local output = self.model.read_user(self, self.sessiondata.userinfo.userid)
if clientdata.Save then
-- just to make sure can't modify any other user from this action
self.clientdata.userid = self.sessiondata.userinfo.userid
+
+ -- As a special case for update_user, settings that don't change are nil
self.clientdata.roles = nil
-- if password is blank, don't update it or require it
if self.clientdata.password == "" then self.clientdata.password = nil end
if self.clientdata.password_confirm == "" then self.clientdata.password_confirm = nil end
+ for name,value in pairs(output.value) do
+ value.value = self.clientdata[name]
+ end
+
-- Update userinfo
- output = self.model.update_user(self, self.clientdata)
+ output = self.model.update_user(self, output)
if not output.errtxt then
output.descr = "Saved user"
end
- else
- output = self.model.read_user(self, self.sessiondata.userinfo.userid)
end
-- Don't allow changing of roles for yourself
@@ -36,21 +40,24 @@ function editme(self)
end
function edituser(self)
- local output
+ local output = self.model.read_user(self, self.clientdata.userid)
if self.clientdata.Save then
+ -- As a special case for update_user, settings that don't change are nil
-- if password is blank, don't update it or require it
if self.clientdata.password == "" then self.clientdata.password = nil end
if self.clientdata.password_confirm == "" then self.clientdata.password_confirm = nil end
+ for name,value in pairs(output.value) do
+ value.value = self.clientdata[name]
+ end
+
-- Update userinfo
- output = self.model.update_user(self, self.clientdata)
+ output = self.model.update_user(self, output)
-- result
if not output.errtxt then
redirect(self, "status")
end
- else
- output = self.model.read_user(self, self.clientdata.userid)
end
output.type = "form"
@@ -60,17 +67,21 @@ function edituser(self)
end
function newuser(self)
- local output
+ local output = self.model.read_user(self)
if self.clientdata.Save then
+ for name,value in pairs(output.value) do
+ if self.clientdata[name] then
+ value.value = self.clientdata[name]
+ end
+ end
+
-- Update userinfo
- output = self.model.create_user(self, self.clientdata)
+ output = self.model.create_user(self, output)
-- result
if not output.errtxt then
redirect(self, "status")
end
- else
- output = self.model.read_user(self)
end
output.type = "form"