wrapper.fhtml: Add `license' relationship to the AGPL link.
[chopwood] / list.fhtml
1 ~1[<!-- -*-html-*-
2 --
3 -- Main account listing and password changing form
4 --
5 -- (c) 2013 Mark Wooding
6 -->
7
8 <!------- Licensing notice --------------------------------------------------
9 --
10 -- This file is part of Chopwood: a password-changing service.
11 --
12 -- Chopwood is free software; you can redistribute it and/or modify
13 -- it under the terms of the GNU Affero General Public License as
14 -- published by the Free Software Foundation; either version 3 of the
15 -- License, or (at your option) any later version.
16 --
17 -- Chopwood is distributed in the hope that it will be useful,
18 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
19 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 -- GNU Affero General Public License for more details.
21 --
22 -- You should have received a copy of the GNU Affero General Public
23 -- License along with Chopwood; if not, see
24 -- <http://www.gnu.org/licenses/>.
25 -->~]~
26
27 <h1>Chopwood: accounts list</h1>
28
29 <form method=POST action="~={script}H">
30
31 <div class=expand-outer>
32 <div class=expand-inner>
33 <table class=expand>
34 <tr><td>
35 <h2><label for=acct-list accesskey=a>Your <u>a</u>ccounts</label></h2>
36 <tr class=expand><td>
37 <select multiple id=acct-list name=services>~={accts}{
38 <option value=~={@.service}H>~
39 ~={@.service}H: ~={@.friendly}:H~={@.alias}@[ (~H)~]~*~}
40 </select>
41 </table>
42 <script type="text/javascript"><!--
43 function check_accounts() {
44 if (elt('acct-list').selectedIndex == -1)
45 return 'No accounts selected.';
46 return null;
47 }
48 FORMS.acct = {
49 elts: ['list'],
50 check: function () { return null; }
51 }~={allowop.set}:[
52
53 // Password setting is forbidden, so here's a stub function.
54 function check_partial_passwd() { return null; }~;~]
55 --></script>
56 </div>
57
58 <div class=expand-reference>
59
60 ~={allowop.set}:[~;<h2>Set a new password</h2>
61 <table>
62 <tr>
63 <td class=label>
64 <label for=set-first accesskey=p>New <u>p</u>assword:</label>
65 <td>
66 <input id=set-first type=password name=first>
67 <tr>
68 <td class=label>
69 <label for=set-second>Confirm password:</label>
70 <td>
71 <input id=set-second type=password name=second>
72 <td>
73 <button type=submit accesskey=s id=set-submit
74 name=%act value=set><u>S</u>et</button>
75 <tr>
76 <td colspan=3 class=whinge id=set-whinge align=center>OK
77 </table>
78 <script type="text/javascript"><!--
79 function check_partial_passwd() {
80 if (elt('set-first').value != '' ||
81 elt('set-second').value != '')
82 return 'Password at least partially entered.';
83 return null;
84 }
85 FORMS.set = {
86 elts: ['first', 'second'],
87 check: function () {
88 var w;
89 if ((w = check_accounts()) !== null)
90 return w;
91 else if (elt('set-first').value == "")
92 return 'Empty password not permitted.';
93 else if (elt('set-first').value != elt('set-second').value)
94 return 'Passwords don\u2019t match.';
95 return null;
96 }
97 }
98 --></script>~2%~]~
99
100 ~={allowop.reset}:[~;<h2>Generate a new password</h2>
101 <button type=submit id=reset-submit accesskey=g
102 name=%act value=reset><u>G</u>enerate</button>
103 <span class=whinge id=reset-whinge>OK</span>
104 <script type="text/javascript"><!--
105 FORMS.reset = {
106 check: function () {
107 return check_accounts() || check_partial_passwd();
108 }
109 }
110 --></script>~2%~]~
111
112 ~={allowop.clear}:[~;<h2>Clear the existing passwords</h2>
113 <button type=submit id=clear-submit accesskey=c
114 name=%act value=clear><u>C</u>lear</button>
115 <span class=whinge id=clear-whinge>OK</span>
116 <script type="text/javascript"><!--
117 FORMS.clear = {
118 check: function () {
119 return check_accounts() || check_partial_passwd();
120 }
121 }
122 --></script>~2%~]~
123
124 </div>
125 </div>
126
127 <input type=hidden name=%user value="~={user}H">
128 <input type=hidden name=%nonce value="~={nonce}H">
129 </form>
130
131 <h2>Log out of Chopwood</h2>
132
133 <form method=POST action="~={script}H/logout">
134 <button type=submit accesskey=o>Log <u>o</u>ut</button>
135 <input type=hidden name=%user value="~={user}H">
136 <input type=hidden name=%nonce value="~={nonce}H">
137 </form>
138
139 ~1[<!------- That's all, folks ------------------------------------------>~]~