chiark / gitweb /
cgi.py (cookie): Exclude attribute keys whose value is false.
[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         }
52 --></script>
53 </div>
54
55 <div class=expand-reference>
56
57 <h2>Set a new password</h2>
58 <table>
59 <tr>
60   <td class=label>
61     <label for=set-first accesskey=p>New <u>p</u>assword:</label>
62   <td>
63     <input id=set-first type=password name=first>
64 <tr>
65   <td class=label>
66     <label for=set-second>Confirm password:</label>
67   <td>
68     <input id=set-second type=password name=second>
69   <td>
70     <button type=submit accesskey=s id=set-submit
71             name=%act value=set><u>S</u>et</button>
72 <tr>
73   <td colspan=3 class=whinge id=set-whinge align=center>OK
74 </table>
75 <script type="text/javascript"><!--
76         function check_partial_passwd() {
77           if (elt('set-first').value != '' ||
78               elt('set-second').value != '')
79             return 'Password at least partially entered.';
80           return null;
81         }
82         FORMS.set = {
83           elts: ['first', 'second'],
84           check: function () {
85             var w;
86             if ((w = check_accounts()) !== null)
87               return w;
88             else if (elt('set-first').value == "")
89               return 'Empty password not permitted.';
90             else if (elt('set-first').value != elt('set-second').value)
91               return 'Passwords don\u2019t match.';
92             return null;
93           }
94         }
95 --></script>
96
97 <h2>Generate a new password</h2>
98 <button type=submit id=reset-submit accesskey=g
99         name=%act value=reset><u>G</u>enerate</button>
100 <span class=whinge id=reset-whinge>OK</span>
101 <script type="text/javascript"><!--
102         FORMS.reset = {
103           check: function () {
104             return check_accounts() || check_partial_passwd();
105           }
106         }
107 --></script>
108
109 <h2>Clear the existing passwords</h2>
110 <button type=submit id=clear-submit accesskey=c
111         name=%act value=clear><u>C</u>lear</button>
112 <span class=whinge id=clear-whinge>OK</span>
113 <script type="text/javascript"><!--
114         FORMS.clear = {
115           check: function () {
116             return check_accounts() || check_partial_passwd();
117           }
118         }
119 --></script>
120
121 </div>
122 </div>
123
124 <input type=hidden name=%nonce value="~={nonce}H">
125 </form>
126
127 ~1[<!------- That's all, folks ------------------------------------------>~]~