5 * @author Ant P <p@cpi.merseine.nu>
6 * @license file://COPYING
11 SO2
::$Page->title
= 'Change Password';
13 if ( ! (SO2
::$User instanceof User_Authenticated
) ) {
14 SO2
::$Page->message(Page
::ERR_LOGIN
);
17 if ( isset($_POST['submit']) ) {
19 if ( ! SO2
::$User->check_nullpass()
20 && strval(SO2
::$User->password
) != $_POST['old'] ) {
21 throw new InvalidInputException('Old password does not match.');
23 if ( $_POST['new'] != $_POST['n2'] ) {
24 throw new InvalidInputException('New password not confirmed correctly.');
26 if ( ! strlen(trim($_POST['new'])) ) {
27 throw new InvalidInputException('New password must not be blank.');
30 SO2
::$User->password
= $_POST['new'];
31 setcookie('p', $_POST['new'], T_NOW+
172800);
33 SO2
::$Page->message('Password changed.', E_USER_NOTICE
);
34 } catch ( InvalidInputException
$e ) {
35 SO2
::$Page->message($e->getMessage(), E_USER_WARNING
);
38 SO2
::$Page->pageheader();
42 <form method
="post" action
="<?php echo $_SERVER['PHP_SELF'] ?>">
46 <th scope
="row"><label
for="old">Old password
</label
></th
>
47 <td
><input type
="password" name
="old" id
="old"<?php
echo SO2
::$User->check_nullpass() ?
' disabled="disabled"' : '' ?
>/></td
>
50 <th scope
="row"><label
for="new">New password
</label
></th
>
51 <td
><input type
="password" name
="new" id
="new"/></td
>
54 <th scope
="row"><label
for="n2">Retype password
</label
></th
>
55 <td
><input type
="password" name
="n2" id
="n2"/></td
>
59 <p
><button type
="submit" name
="submit">Confirm
</button
></p
>