]> git.mjollnir.org Git - moodle.git/commitdiff
Changed headers so that it works seamlessly when called from user page.
authormoodler <moodler>
Thu, 17 Oct 2002 12:21:55 +0000 (12:21 +0000)
committermoodler <moodler>
Thu, 17 Oct 2002 12:21:55 +0000 (12:21 +0000)
login/change_password.php
login/change_password_form.html

index 95703f716d67eaafb8580702bcf0c3b9ee0be658..d4fbe961922fa8cc86e57026db45012e52074d5e 100644 (file)
@@ -2,6 +2,13 @@
 
        include("../config.php");
 
+    optional_variable($id);
+
+    if ($id) {
+        if (!$course = get_record("course", "id", $id)) {
+            error("No such course!");
+        }
+    }
 
        if (match_referer() && isset($HTTP_POST_VARS)) {
 
 
                        reset_login_count();
 
-            $passwordchanged = get_string("passwordchanged");
-                       print_header($passwordchanged, $passwordchanged, $passwordchanged, "");
-                       notice($passwordchanged, "$CFG->wwwroot/course/");
+            $strpasswordchanged = get_string("passwordchanged");
+
+            if ($course->id) {
+                   print_header($strpasswordchanged, $strpasswordchanged,
+                             "<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A> ->
+                              <A HREF=\"$CFG->wwwroot/user/index.php?id=$course->id\">".get_string("participants")."</A> ->
+                              <A HREF=\"$CFG->wwwroot/user/view.php?id=$USER->id&course=$course->id\">$USER->firstname $USER->lastname</A> -> $strpasswordchanged", $focus);
+                           notice($strpasswordchanged, "$CFG->wwwroot/user/view.php?id=$USER->id&course=$id");
+            } else {
+                           print_header($strpasswordchanged, $strpasswordchanged, $strpasswordchanged, "");
+                           notice($strpasswordchanged, "$CFG->wwwroot");
+            }
+
                        print_footer();
                        exit;
                }
 
 
 
+    if ($course->id) {
+        $frm->id = $id;
+    }
+
        if (!$frm->username)
        $frm->username = get_moodle_cookie();
 
        $focus = "form.username";
        }
 
-    $changepassword = get_string("changepassword");
-       print_header($changepassword, $changepassword, $changepassword, $focus);
+    $strchangepassword = get_string("changepassword");
+    if ($course->id) {
+           print_header($strchangepassword, $strchangepassword,
+                     "<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A> ->
+                      <A HREF=\"$CFG->wwwroot/user/index.php?id=$course->id\">".get_string("participants")."</A> ->
+                      <A HREF=\"$CFG->wwwroot/user/view.php?id=$USER->id&course=$course->id\">$USER->firstname $USER->lastname</A> -> $strchangepassword", $focus);
+    } else {
+           print_header($strchangepassword, $strchangepassword, $strchangepassword, $focus);
+    }
+
     print_simple_box_start("center", "", $THEME->cellheading);
        include("change_password_form.html");
     print_simple_box_end();
index cf52bd918f09fdeba83335240e6cbb327d52ddff..279e6cb1633f35611d7b5bb0ffcf012b59e800cb 100644 (file)
 </tr>
 <tr valign=top>
        <td><P><? print_string("password") ?>:</P></td>
-       <td><input type="text" name="password" size=25 value="<? p($frm->password) ?>">
+       <td><input type="password" name="password" size=25 value="<? p($frm->password) ?>">
        <? formerr($err->password) ?>
        </td>
 </tr>
 <tr valign=top>
        <td><P><? print_string("newpassword") ?>:</P></td>
-       <td><input type="text" name="newpassword1" size=25 value="<? p($frm->newpassword1) ?>">
+       <td><input type="password" name="newpassword1" size=25 value="<? p($frm->newpassword1) ?>">
        <? formerr($err->newpassword1) ?>
        </td>
 </tr>
 <tr valign=top>
        <td><P><? print_string("newpassword") ?> (<? print_string("again") ?>):</P></td>
-       <td><input type="text" name="newpassword2" size=25 value="<? p($frm->newpassword2) ?>">
+       <td><input type="password" name="newpassword2" size=25 value="<? p($frm->newpassword2) ?>">
        <? formerr($err->newpassword2) ?>
        </td>
 </tr>
 <tr>
        <td></td>
-       <td><input type="submit" value="<? print_string("changepassword") ?>"></td>
+    <td><input type="hidden" name="id" value="<?=$frm->id?>">
+       <input type="submit" value="<? print_string("changepassword") ?>"></td>
 </table>
 </form>