summaryrefslogtreecommitdiffstats
path: root/openssh-listauth-html.lsp
blob: 8d8ebadf7e081f36fdf1bc34381fc15967240a39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<% local view, viewlibrary, page_info, session = ... %>
<% htmlviewfunctions = require("htmlviewfunctions") %>
<% html = require("acf.html") %>

<script type="text/javascript">
	if (typeof jQuery == 'undefined') {
		document.write('<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery-latest.js"><\/script>');
	}
</script>

<script type="text/javascript">
	if (typeof $.tablesorter == 'undefined') {
		document.write('<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery.tablesorter.js"><\/script>');
	}
</script>

<script type="text/javascript">
	$(document).ready(function() {
		$("#list").tablesorter({headers: {0:{sorter: false}}, widgets: ['zebra']});
	});
</script>

<% htmlviewfunctions.displaycommandresults({"deleteauth"}, session) %>
<% htmlviewfunctions.displaycommandresults({"addauth"}, session, true) %>

<h1>Authorized Keys for <%= html.html_escape(view.value.user.value) %></h1>
<table id="list" class="tablesorter"><thead>
	<tr>
		<th>Action</th>
		<th>ID</th>
		<th>Key</th>
	</tr>
</thead><tbody>
<% for i,auth in ipairs(view.value.auth.value) do %>
	<tr>
		<td>
<form action="<%= html.html_escape(page_info.script..page_info.prefix..page_info.controller.."/deleteauth") %>" method="post">
<input class="hidden" type="hidden" name="user" value="<%= html.html_escape(view.value.user.value) %>">
<input class="hidden" type="hidden" name="auth" value="<%= html.html_escape(auth.id) %>">
<input class="submit" type="submit" name="submit" value="Delete">
</form>
		</td>
		<td><%= html.html_escape(auth.id) %></td>
		<td><% if #auth.key>32 then io.write(html.html_escape(string.sub(auth.key,0,16)) .. "  ...  " .. html.html_escape(string.sub(auth.key, -16))) else io.write(html.html_escape(auth.key)) end %></td>
	</tr>
<% end %>
</tbody></table>
<p>In order to preserve keys with lbu, you must add /<% if view.value.user.value ~= "root" then io.write("home/") end %><%= view.value.user.value %>/.ssh/authorized_keys to lbu include

<% viewlibrary.dispatch_component("addauth", {user=view.value.user.value}) %>