chiark / gitweb /
httpauth.py: Abstract out setting the various cookie attributes.
[chopwood] / list.fhtml
CommitLineData
a2916c06
MW
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
138df99f 29<form method=POST action="~={script}H">
a2916c06
MW
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>
138df99f 42<script type="text/javascript"><!--
a2916c06
MW
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; }
4e7866ab
MW
51 }~={allowop.set}:[
52
53 // Password setting is forbidden, so here's a stub function.
54 function check_partial_passwd() { return null; }~;~]
a2916c06
MW
55--></script>
56</div>
57
58<div class=expand-reference>
59
4e7866ab 60~={allowop.set}:[~;<h2>Set a new password</h2>
a2916c06
MW
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>
138df99f 78<script type="text/javascript"><!--
a2916c06
MW
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)
e8410ae0 94 return 'Passwords don\u2019t match.';
a2916c06
MW
95 return null;
96 }
97 }
4e7866ab 98--></script>~2%~]~
a2916c06 99
4e7866ab 100~={allowop.reset}:[~;<h2>Generate a new password</h2>
a2916c06
MW
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>
138df99f 104<script type="text/javascript"><!--
a2916c06
MW
105 FORMS.reset = {
106 check: function () {
107 return check_accounts() || check_partial_passwd();
108 }
109 }
4e7866ab 110--></script>~2%~]~
a2916c06 111
4e7866ab 112~={allowop.clear}:[~;<h2>Clear the existing passwords</h2>
a2916c06
MW
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>
138df99f 116<script type="text/javascript"><!--
a2916c06
MW
117 FORMS.clear = {
118 check: function () {
119 return check_accounts() || check_partial_passwd();
120 }
121 }
4e7866ab 122--></script>~2%~]~
a2916c06
MW
123
124</div>
125</div>
126
ba8f1b92 127<input type=hidden name=%user value="~={user}H">
138df99f 128<input type=hidden name=%nonce value="~={nonce}H">
a2916c06
MW
129</form>
130
131~1[<!------- That's all, folks ------------------------------------------>~]~