
<?php 
    // only display this help message if we are being forced to change
    if ($forcepassword) {
        notify( get_string('forcepasswordchangenotice') );
    }
 ?>
<p><b><?php print_string("allfieldsrequired") ?></b></p>
<?php
   if (empty($frm->username)) {
       $frm->username = "";
   }
   if (empty($frm->password)) {
       $frm->password = "";
   }
   if (empty($frm->newpassword1)) {
       $frm->newpassword1 = "";
   }
   if (empty($frm->newpassword2)) {
       $frm->newpassword2 = "";
   }
?>
<form action="change_password.php" method="post" name="form" id="form">
<table cellpadding="10">

<tr valign="top">
    <td><?php print_string("username") ?>:</td>
    <td>
    <?php if (isadmin() || empty($frm->username)) { ?>
        <input type="text" name="username" size="25" value="<?php p($frm->username) ?>" alt="<?php print_string("username") ?>" />
    <?php } else { ?>
        <input type="hidden" name="username" value="<?php p($frm->username)?>" />  <?php p($frm->username)?>
    <?php } ?>
    <?php if (!empty($err->username)) { formerr($err->username); } ?>
    </td>
</tr>

<?php if (!isadmin()) { ?>
    <tr valign="top">
        <td><?php print_string("oldpassword") ?>:</td>
        <td><input type="password" name="password" size="25" value="<?php p($frm->password) ?>" alt="<?php print_string("password") ?>" />
        <?php if (!empty($err->password)) { formerr($err->password); } ?>
        </td>
    </tr>
<?php } ?>

<tr valign="top">
    <td><?php print_string("newpassword") ?>:</td>
    <td><input type="password" name="newpassword1" size="25" value="<?php p($frm->newpassword1) ?>" alt="<?php print_string("newpassword") ?>" />
    <?php if (!empty($err->newpassword1)) { formerr($err->newpassword1); } ?>
    </td>
</tr>
<tr valign="top">
    <td><?php print_string("newpassword") ?> (<?php print_string("again") ?>):</td>
    <td><input type="password" name="newpassword2" size="25" value="<?php p($frm->newpassword2) ?>" alt="<?php print_string("newpassword") ?> (<?php print_string("again") ?>)" />
    <?php if (!empty($err->newpassword2)) { formerr($err->newpassword2); } ?>
    </td>
</tr>
<tr>
    <td></td>
    <td><input type="hidden" name="id" value="<?php p($frm->id)?>" />
    <input type="submit" value="<?php print_string("changepassword") ?>" /></td>
    </tr>
  </table>
</form>
