3 -- Main account listing and password changing form
5 -- (c) 2013 Mark Wooding
8 <!------- Licensing notice --------------------------------------------------
10 -- This file is part of Chopwood: a password-changing service.
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.
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.
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/>.
27 <h1>Chopwood: accounts list</h1>
29 <form method=POST action="~={script}H">
31 <div class=expand-outer>
32 <div class=expand-inner>
35 <h2><label for=acct-list accesskey=a>Your <u>a</u>ccounts</label></h2>
37 <select multiple id=acct-list name=services>~={accts}{
38 <option value=~={@.service}H>~
39 ~={@.service}H: ~={@.friendly}:H~={@.alias}@[ (~H)~]~*~}
42 <script type="text/javascript"><!--
43 function check_accounts() {
44 if (elt('acct-list').selectedIndex == -1)
45 return 'No accounts selected.';
50 check: function () { return null; }
53 // Password setting is forbidden, so here's a stub function.
54 function check_partial_passwd() { return null; }~;~]
58 <div class=expand-reference>
60 ~={allowop.set}:[~;<h2>Set a new password</h2>
64 <label for=set-first accesskey=p>New <u>p</u>assword:</label>
66 <input id=set-first type=password name=first>
69 <label for=set-second>Confirm password:</label>
71 <input id=set-second type=password name=second>
73 <button type=submit accesskey=s id=set-submit
74 name=%act value=set><u>S</u>et</button>
76 <td colspan=3 class=whinge id=set-whinge align=center>OK
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.';
86 elts: ['first', 'second'],
89 if ((w = check_accounts()) !== null)
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.';
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"><!--
107 return check_accounts() || check_partial_passwd();
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"><!--
119 return check_accounts() || check_partial_passwd();
127 <input type=hidden name=%user value="~={user}H">
128 <input type=hidden name=%nonce value="~={nonce}H">
131 <h2>Log out of Chopwood</h2>
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">
139 ~1[<!------- That's all, folks ------------------------------------------>~]~