summaryrefslogtreecommitdiffstats
path: root/freeradius3-viewpasswdfile-html.lsp
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2014-09-15 16:25:12 +0000
committerTed Trask <ttrask01@yahoo.com>2014-09-15 16:25:12 +0000
commit47c61e5dd2476f6eab7d50b1794d29412759858f (patch)
tree9e98ceeed681901edee824913baa78fff52dcead /freeradius3-viewpasswdfile-html.lsp
parentabaa1ce203d44749ca6073cb55c2016b6787deb0 (diff)
downloadacf-freeradius3-47c61e5dd2476f6eab7d50b1794d29412759858f.tar.bz2
acf-freeradius3-47c61e5dd2476f6eab7d50b1794d29412759858f.tar.xz
Implement createpasswdentry and editpasswd actions
There are known problems with handling blank passwords and redirecting to viewpasswdfile
Diffstat (limited to 'freeradius3-viewpasswdfile-html.lsp')
-rw-r--r--freeradius3-viewpasswdfile-html.lsp25
1 files changed, 19 insertions, 6 deletions
diff --git a/freeradius3-viewpasswdfile-html.lsp b/freeradius3-viewpasswdfile-html.lsp
index b4e8ce5..d6cc3eb 100644
--- a/freeradius3-viewpasswdfile-html.lsp
+++ b/freeradius3-viewpasswdfile-html.lsp
@@ -21,25 +21,29 @@ html = require("acf.html")
});
</script>
-<% htmlviewfunctions.displaycommandresults({"editpasswdentry"}, session) %>
+<% htmlviewfunctions.displaycommandresults({"editpasswdentry", "editpasswd"}, session) %>
+<% htmlviewfunctions.displaycommandresults({"createpasswdentry"}, session, true) %>
+
+<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %>
+<% -- This is a hack to redirect back to viewing the same file
+redir.value = redir.value.."?filename="..html.url_encode(view.value.filename.value)
+%>
<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %>
<% htmlviewfunctions.displayitem(view.value.filename) %>
<% if view.value.data then %>
+<% local containspasswd = 0 %>
<table id="list" class="tablesorter"><thead>
<tr>
<th>Action</th>
<% for i,f in ipairs(view.value.fields.value) do %>
+ <% if f == "Crypt-Password" then containspasswd = i end %>
<th><%= html.html_escape(f) %></th>
<% end %>
</tr>
</thead><tbody>
<% local filename = cfe({ type="hidden", value=view.value.filename.value }) %>
<% local entry = cfe({ type="hidden", value="" }) %>
-<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %>
-<% -- This is a hack to redirect back to viewing the same file
-redir.value = redir.value.."?filename="..html.url_encode(view.value.filename.value)
-%>
<% for i,r in ipairs( view.value.data.value ) do %>
<tr>
<td>
@@ -47,12 +51,21 @@ redir.value = redir.value.."?filename="..html.url_encode(view.value.filename.val
<% if viewlibrary.check_permission("editpasswdentry") then %>
<% htmlviewfunctions.displayitem(cfe({type="link", value={filename=filename, entry=entry, redir=redir}, label="", option="Edit", action="editpasswdentry"}), page_info, -1) %>
<% end %>
+ <% if 0 < containspasswd and r[containspasswd] ~= "" and viewlibrary.check_permission("editpasswd") then %>
+ <% htmlviewfunctions.displayitem(cfe({type="link", value={filename=filename, entry=entry, redir=redir}, label="", option="Change Pass", action="editpasswd"}), page_info, -1) %>
+ <% end %>
</td>
<% for j,f in ipairs(r) do %>
- <td><%= html.html_escape(f) %></td>
+ <td><% if (j == containspasswd) and (f ~= "") then io.write("********") else io.write(html.html_escape(f)) end %></td>
<% end %>
</tr>
<% end %>
</tbody></table>
<% end %>
+
+<% if view.value.data and viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("createpasswdentry") then
+ local createform = viewlibrary.dispatch_component("createpasswdentry", {filename=view.value.filename.value, redir=redir.value}, true)
+ createform.action = page_info.script .. page_info.prefix .. page_info.controller .. "/createpasswdentry"
+ htmlviewfunctions.displayitem(createform, page_info, htmlviewfunctions.incrementheader(header_level))
+end %>
<% htmlviewfunctions.displaysectionend(header_level) %>