5 * @author Anthony Parsons (xmpp:ant@specialops.ath.cx)
6 * @license file://COPYING
11 $page->title
= 'Change Password';
13 if ( ! ($user instanceof User_Authenticated
) )
14 $page->errorfooter('login');
16 if ( isset($_POST['submit']) ) {
18 if ( !$user->check_nullpass() && strval($user->password
) != $_POST['old'] ) {
19 throw new InvalidInputException('Old password does not match.');
21 if ( $_POST['new'] != $_POST['n2'] ) {
22 throw new InvalidInputException('New password not confirmed correctly.');
24 if ( !strlen(trim($_POST['new'])) ) {
25 throw new InvalidInputException('New password must not be blank.');
28 $user->password
= $_POST['new'];
29 setcookie('p', $_POST['new'], time()+
86400, '/');
32 echo '<p class="notice">Password changed.</p>';
33 } catch ( InvalidInputException
$e ) {
35 echo '<p class="error">',$e->getMessage(),'</p>';
42 <form method
="post" action
="<?php echo $_SERVER['PHP_SELF'] ?>">
45 <tr
><th scope
="row"><label
for="old">Old password
</label
></th
>
46 <td
><input type
="password" name
="old" id
="old"<?php
47 echo $user->check_nullpass() ?
' disabled="disabled"' : '' ?
>/></td
></tr
>
48 <tr
><th scope
="row"><label
for="new">New password
</label
></th
>
49 <td
><input type
="password" name
="new" id
="new"/></td
></tr
>
50 <tr
><th scope
="row"><label
for="n2">Retype password
</label
></th
>
51 <td
><input type
="password" name
="n2" id
="n2"/></td
></tr
>
55 <p
><button type
="submit" name
="submit" accesskey
="c">Confirm (C
)</button
></p
>