summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMika Havela <mika.havela@gmail.com>2008-03-03 16:43:54 +0000
committerMika Havela <mika.havela@gmail.com>2008-03-03 16:43:54 +0000
commit27229e34b183a43da4c8868c457bf3cefd177403 (patch)
tree010086a2e5f8a0d641a113dd25b80c3e3695e612
parente60153cec807eabb371f15a25a56cfc4f574fe53 (diff)
downloadacf-core-27229e34b183a43da4c8868c457bf3cefd177403.tar.bz2
acf-core-27229e34b183a43da4c8868c457bf3cefd177403.tar.xz
Redirecting the user to logon-page when someone is trying to edit passwords when not logged on
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@787 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rwxr-xr-xapp/acf-util/password-controller.lua29
1 files changed, 26 insertions, 3 deletions
diff --git a/app/acf-util/password-controller.lua b/app/acf-util/password-controller.lua
index 333786a..fb78150 100755
--- a/app/acf-util/password-controller.lua
+++ b/app/acf-util/password-controller.lua
@@ -23,6 +23,17 @@ local function admin_permission()
end
end
+local function check_logonstatus(self)
+ -- Redirect the user if he's not logged in.
+ if not (self.sessiondata.userinfo) then
+ self.conf.action = "logon"
+ self.conf.controller = "logon"
+ self.conf.type = "redir"
+ error (self.conf)
+ return self
+ end
+end
+
local function get_config(self,userid)
local config = {}
local userinfo = {}
@@ -82,6 +93,10 @@ local function get_config(self,userid)
end
function status(self)
+
+ -- Redirect the user if he's not logged in.
+ check_logonstatus(self)
+
local status = {}
-- Check for admin persmissions - else redirect to personal options
@@ -154,10 +169,14 @@ function status(self)
value="Create",
-- disabled="yes",
})
- return { status=status }
+ return { status=status }
end
function administrator(self)
+
+ -- Redirect the user if he's not logged in.
+ check_logonstatus(self)
+
local output = {}
-- Check for admin persmissions - else redirect to personal options
@@ -192,7 +211,8 @@ end
function edit_me(self)
- -- FIXME: Redirect to Welcome or logon if user is not logged on
+ -- Redirect the user if he's not logged in.
+ check_logonstatus(self)
-- Output userinfo
local output = get_config(self,sessiondata.userinfo.userid)
@@ -218,7 +238,7 @@ function edit_me(self)
return {config=output}
end
-clientdata_from_roles = function(self)
+local clientdata_from_roles = function(self)
local output = {}
for k,v in pairs(auth.list_roles()) do
@@ -231,6 +251,9 @@ clientdata_from_roles = function(self)
end
function save(self)
+ -- Redirect the user if he's not logged in.
+ check_logonstatus(self)
+
local errormessage = {}
local cmdresult = {}