diff options
-rw-r--r-- | app/acf-util/logon-controller.lua | 7 | ||||
-rwxr-xr-x | app/acf-util/password-controller.lua | 17 | ||||
-rwxr-xr-x | app/acf-util/password-html.lsp | 8 | ||||
-rwxr-xr-x | app/acf-util/password-model.lua | 7 | ||||
-rwxr-xr-x | app/acf-util/password-status-html.lsp | 18 |
5 files changed, 28 insertions, 29 deletions
diff --git a/app/acf-util/logon-controller.lua b/app/acf-util/logon-controller.lua index e3a84df..e909fb9 100644 --- a/app/acf-util/logon-controller.lua +++ b/app/acf-util/logon-controller.lua @@ -14,10 +14,15 @@ logon = function(self) -- If successful logon, redirect to welcome-page, otherwise try again if logon.value then cmdresult.descr = "Logon Successful" - redirect(self, "/welcome/read") else cmdresult.errtxt = "Logon Attempt Failed" end + cmdresult = self:redirect_to_referrer(cmdresult) + if logon.value then + redirect(self, "/welcome/read") + end + else + cmdresult = self:redirect_to_referrer() or cmdresult end return cmdresult end diff --git a/app/acf-util/password-controller.lua b/app/acf-util/password-controller.lua index 9ad8e04..b248808 100755 --- a/app/acf-util/password-controller.lua +++ b/app/acf-util/password-controller.lua @@ -24,10 +24,12 @@ function editme(self) -- Update userinfo output = self.model.update_user(self, output) - if not output.errtxt then output.descr = "Saved user" end + output = self:redirect_to_referrer(output) + else + output = self:redirect_to_referrer() or output end -- Don't allow changing of roles for yourself @@ -53,11 +55,12 @@ function edituser(self) -- Update userinfo output = self.model.update_user(self, output) - - -- result if not output.errtxt then redirect(self, "status") end + output = self:redirect_to_referrer(output) + else + output = self:redirect_to_referrer() or output end output.type = "form" @@ -77,11 +80,12 @@ function newuser(self) -- Update userinfo output = self.model.create_user(self, output) - - -- result if not output.errtxt then redirect(self, "status") end + output = self:redirect_to_referrer(output) + else + output = self:redirect_to_referrer() or output end output.type = "form" @@ -91,6 +95,5 @@ function newuser(self) end function deleteuser(self) - self.model.delete_user(self, self.clientdata.userid) - redirect(self, "status") + return self:redirect_to_referrer(self.model.delete_user(self, self.clientdata.userid)) end diff --git a/app/acf-util/password-html.lsp b/app/acf-util/password-html.lsp index 5f081c3..d845316 100755 --- a/app/acf-util/password-html.lsp +++ b/app/acf-util/password-html.lsp @@ -22,11 +22,3 @@ io.write("</span>") local order = { "userid", "username", "roles", "password", "password_confirm" } displayform(form, order) ?> - -<? ---[[ DEBUG INFORMATION -io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>") -io.write(html.cfe_unpack(form)) -io.write("</span>") ---]] -?> diff --git a/app/acf-util/password-model.lua b/app/acf-util/password-model.lua index 7454d79..1e78e5d 100755 --- a/app/acf-util/password-model.lua +++ b/app/acf-util/password-model.lua @@ -116,5 +116,10 @@ function get_users(self) end function delete_user(self, userid) - auth.delete_user(self, userid) + local result, errmessages = auth.delete_user(self, userid) + local value + if result then value = "User Deleted" else value = "Failed to Delete User" end + local errtxt + if #errmessages > 0 then errtxt = errmessages:concat("\n") end + return cfe({ value=value, errtxt=errtxt, label="Delete User Result" }) end diff --git a/app/acf-util/password-status-html.lsp b/app/acf-util/password-status-html.lsp index e0b4d09..c16e0d6 100755 --- a/app/acf-util/password-status-html.lsp +++ b/app/acf-util/password-status-html.lsp @@ -1,4 +1,5 @@ -<? local form, viewlibrary, pageinfo = ... ?> +<? local form, viewlibrary, pageinfo, session = ... ?> +<? require("viewfunctions") ?> <? --[[ DEBUG INFORMATION io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>") @@ -7,10 +8,12 @@ io.write("</span>") --]] ?> -<H1>USER ACCOUNTS</H1> +<? displaycommandresults({"deleteuser"}, session) ?> + +<H1>User Accounts</H1> <H2>Create new account</H2> <form action="newuser" method="POST"> -<dl><dt><input class="submit" type="submit" value="New User"></dt></dl> +<dl><dt></dt><dd><input class="submit" type="submit" value="New User"></dd></dl> </form> <H2>Existing account</H2> <DL> @@ -37,12 +40,3 @@ io.write("</span>") </TABLE></DD> <? end ?> </DL> - -<? ---[[ DEBUG INFORMATION -io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>") -io.write(html.cfe_unpack(form)) -io.write("</span>") ---]] -?> - |