5 // Mark Huang <mlhuang@cs.princeton.edu>
6 // Copyright (C) 2007 The Trustees of Princeton University
11 // Get session and API handles
12 require_once 'plc_session.php';
13 global $plc, $api, $adm;
15 // Only display dialogs if the user is not logged in.
18 require_once 'plc_drupal.php';
19 include 'plc_header.php';
21 if (!empty($_REQUEST['id']) && !empty($_REQUEST['key'])) {
22 $person_id = intval($_REQUEST['id']);
23 drupal_set_title('Password Reset: Confirmed');
24 if ($adm->ResetPassword($person_id, $_REQUEST['key']) != 1) {
25 print '<div class="messages error">' . $adm->error() . '.</div>';
27 print '<div class="messages status">';
28 print "Success! We've sent you another e-mail with your new temporary password. <br/>";
29 print "You can login using this temporaray password. <br/>";
30 print "Please change it once you login by visiting 'My Account' and updating your password. ";
33 } elseif (!empty($_REQUEST['email'])) {
34 drupal_set_title('Password Reset: Request Sent');
35 if ($adm->ResetPassword($_REQUEST['email']) != 1) {
36 print '<div class="messages error">' . $adm->error() . '.</div>';
38 print '<div class="messages status">';
39 print "We've sent an e-mail to " . $_REQUEST['email'] . " that will allow you to confirm the password reset. <br/>";
40 print "Please check your email now and follow the link contained there to reset your password. ";
45 drupal_set_title('Password Reset');
46 $self = $_SERVER['PHP_SELF'];
47 if (!empty($_SERVER['QUERY_STRING'])) {
48 $self .= "?" . $_SERVER['QUERY_STRING'];
51 // XXX Use our own stylesheet instead of drupal.css
54 <form action="$self" method="post">
56 <table border="0" cellpadding="0" cellspacing="0" id="content">
59 <div class="form-item">
60 E-mail: <span class="form-required" title="This field is required.">*</span></label>
61 <input type="text" maxlength="60" name="email" id="edit-name" size="30" value="" class="form-text required" />
63 <input type="submit" name="op" value="Reset password" class="form-submit" />
73 include 'plc_footer.php';
76 // Otherwise display the user's account page.
77 Header("Location: /db/persons/index.php?id=" . $plc->person['person_id']);