From 3d45676a1116e285018c0072ebd23f2095523bff Mon Sep 17 00:00:00 2001 From: Mika Havela Date: Mon, 18 Feb 2008 19:52:34 +0000 Subject: Moved password-manager to core git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@750 ab2d0c66-481e-0410-8bed-d214d4d58bed --- app/acf-util/password-controller.lua | 47 ++++++++++++++++++++ app/acf-util/password-edit-html.lsp | 72 ++++++++++++++++++++++++++++++ app/acf-util/password-read-html.lsp | 2 + app/acf-util/password-status-html.lsp | 82 +++++++++++++++++++++++++++++++++++ app/acf-util/password.menu | 3 ++ 5 files changed, 206 insertions(+) create mode 100755 app/acf-util/password-controller.lua create mode 100755 app/acf-util/password-edit-html.lsp create mode 100755 app/acf-util/password-read-html.lsp create mode 100755 app/acf-util/password-status-html.lsp create mode 100755 app/acf-util/password.menu (limited to 'app/acf-util') diff --git a/app/acf-util/password-controller.lua b/app/acf-util/password-controller.lua new file mode 100755 index 0000000..c19d6b4 --- /dev/null +++ b/app/acf-util/password-controller.lua @@ -0,0 +1,47 @@ +module(..., package.seeall) + +local list_redir = function (self) + self.conf.action = "status" + self.conf.type = "redir" + error (self.conf) +end + +mvc = {} +mvc.on_load = function(self, parent) + if (self.worker[self.conf.action] == nil ) or ( self.conf.action == "init" ) then + self.worker[self.conf.action] = list_redir(self) + end +end + +function status(self) + local status=self.model.getstatus(self) + status.cmdnew = cfe ({ + name="cmdnew", + type="submit", + label="Create new account", + value="Create", + disabled="yes", + }) + return { status=status } +end + +function edit(self) + local config=self.model.getsettings(self.clientdata.userid) + config.cmdsave = cfe ({ + name="cmdsave", + type="submit", + label="Save changes", + value="Save", + disabled="yes", + }) + config.cmddelete = cfe ({ + name="cmddelete", + type="submit", + label="Delete this account", + value="Delete", + disabled="yes", + }) + + return { config=config, clientdata=self.clientdata } +end + diff --git a/app/acf-util/password-edit-html.lsp b/app/acf-util/password-edit-html.lsp new file mode 100755 index 0000000..8b295b5 --- /dev/null +++ b/app/acf-util/password-edit-html.lsp @@ -0,0 +1,72 @@ + +DEBUGGING

DEBUG INFO: CFE

") +io.write(html.cfe_unpack(form)) +io.write("
") +--]] +?> +") + for k,v in pairs(tags) do + if (myform[v]) and (myform[v]["value"]) then + local val = myform[v] + io.write("\n\t 0) then + val.class = "error" + io.write(" class='error'") + end + io.write(">" .. val.label .. "\n") + if (viewonly) then + io.write("\t\t
" .. val.value .. "\n") + else + io.write("\t\t
" .. html.form[val.type](val) .. "\n") + end + if (#val.errtxt > 0) then io.write("\t\t

" .. string.gsub(val.errtxt, "\n", "
") .. "

\n") end + io.write("\t\t
\n") + end + end + io.write("") +end +?> + +

CONFIG

+

Settings

+ + +") +io.write("\n\t 0) then + myform.class = "error" + io.write(" class='error'") +end +io.write(">" .. myform.label .. "") +io.write("\n\t\t
") +for k,v in pairs(myform.option) do + local checked = "" + if (form.config.userid.roles[v]) then checked = "checked='yes'" end + io.write("\n\t\t\t" ..v .. ": ") +end +if (#myform.errtxt > 0) then io.write("\t\t

" .. string.gsub(myform.errtxt, "\n", "
") .. "

\n") end +io.write("\n\t\t
\n") +io.write("") +?> + +

Actions

+ + diff --git a/app/acf-util/password-read-html.lsp b/app/acf-util/password-read-html.lsp new file mode 100755 index 0000000..9ab91bf --- /dev/null +++ b/app/acf-util/password-read-html.lsp @@ -0,0 +1,2 @@ + +

The local root password is

diff --git a/app/acf-util/password-status-html.lsp b/app/acf-util/password-status-html.lsp new file mode 100755 index 0000000..45bed4f --- /dev/null +++ b/app/acf-util/password-status-html.lsp @@ -0,0 +1,82 @@ + +DEBUGGING

DEBUG INFO: CFE

") +io.write(html.cfe_unpack(form)) +io.write("
") +--]] +?> + +") + for k,v in pairs(tags) do + if (myform[v]) and (myform[v]["value"]) then + local val = myform[v] + io.write("\t 0) then + val.class = "error" + io.write(" class='error'") + end + io.write(">" .. val.label .. "\n") + if (viewonly) then + io.write("\t\t
" .. val.value .. "\n") + else + io.write("\t\t
" .. html.form[val.type](val) .. "\n") + end + if (val.descr) and (#val.descr > 0) then io.write("\t\t

" .. string.gsub(val.descr, "\n", "
") .. "

\n") end + if (#val.errtxt > 0) then io.write("\t\t

" .. string.gsub(val.errtxt, "\n", "
") .. "

\n") end + io.write("\t\t
\n") + end + end + io.write("") +end +?> + +

USER ACCOUNTS

+

Create new account

+ + +

Existing account

+") +if (type(myform) == "table") then + for k,v in pairs(myform) do + local myform = myform[k] + io.write("\t 0) then + myform.class = "error" + io.write(" class='error'") + end + io.write("> " .. myform.label .. "\n") + io.write("\t\t
\n\t\t") + io.write("\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t") + io.write("\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t") + io.write("\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t") + io.write("\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t") + io.write("\n\t\t
Account name:" .. myform.value .. "
Description:" .. (myform.descr or "") .. "
Roles:") + io.write(tostring(myform.roles)) + io.write("
Options:[Edit this account]
\n") + if (#myform.errtxt > 0) then io.write("\t\t

" .. string.gsub(myform.errtxt, "\n", "
") .. "

\n") end + io.write("\t\t
\n") + end +end +io.write("") +?> + + +DEBUGGING

DEBUG INFO: CFE

") +io.write(html.cfe_unpack(form)) +io.write("
") +--]] +?> + diff --git a/app/acf-util/password.menu b/app/acf-util/password.menu new file mode 100755 index 0000000..3965745 --- /dev/null +++ b/app/acf-util/password.menu @@ -0,0 +1,3 @@ +#CAT GROUP/DESC TAB ACTION +System 01Password Status status + -- cgit v1.2.3