DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (87e68dba52ef)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<head>
	<title>Mozilla Labs / Weave / Forgot Password</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <link rel='stylesheet' href='css/weave.css' type='text/css' media='all' />
</head>
<body>
  
<img class="centered" src="images/weave-header.png" />

<div id="content">


<?php

include_once 'ldap.php';

$form = <<<EOD
<div class="box">
<form class="mainForm" name="forgotPass" id="forgotPass" action="forgot.php" method="post">
<p>
	<label>Enter your username to begin<br />
	<input type="text" name="uid" id="user_login" size="20" /></label>
</p>
<p class="submit">
	<input type="submit" id="fpsubmit" name="fpsubmit" value="Submit" />
</p>
<p>&nbsp;</p>
</form>
</div>
EOD;

if (!isset($_POST['uid'])) {
  echo $form;
} else {
  $ldap = new MozLDAP('localhost', 'mail=oremj@mozilla.com,c=mpt,dc=mozilla', 'tester');
  if (!$ldap->valueExists('uid', $_POST['uid'])) {
    echo '<div class="error">That userID does not exist.</div>';
    echo $form;
  } else {
    $mail = $ldap->getAttribute($_POST['uid'], 'mail');
    if (!$mail) {
      echo '<div class="error">You did not specify an email address when you registered. Sorry, you cannot reset your password!</div>';
      echo $form;
    } else {
      $uid = urlencode($_POST['uid']);
      $key = sha1(mt_rand().$_POST['uid']);
      $ldap->setAttribute($_POST['uid'], 'mail-verified', $key);
      
      $headers  = 'MIME-Version: 1.0' . "\r\n";
      $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
      $headers .= 'From: Mozilla Labs <noreply@mozilla.com>' . "\r\n";

      $message = <<<EOT
Mozilla Labs Account Password Reset\r\n
Please visit\r\n
https://services.mozilla.com/reset.php?key=$key&uid=$uid\r\n
to reset your account password.\r\n
EOT;

      mail($mail[0], 'Mozilla Labs Account Password Reset: services.mozilla.com', $message, $headers);
      
      $msg = <<<EOT
<div class="box">
<form class="mainForm">
<p>
  <label>Further instructions have been sent to your email address.</label>
</p>
</form>
</div>
EOT;
      echo $msg;
    }
  }
}

?>

</div>
<div id="footer">
  <p>
    <a href="https://services.mozilla.com/">Take me back to the Weave home page</a>
  </p>
  <br />
  <p>&copy; 2008, Mozilla</p>
  <p>
    <a href="http://www.mozilla.com/en-US/about/legal.html">Legal Notices</a>
    |
    <a href="http://www.mozilla.com/en-US/privacy-policy.html">Privacy Policy</a>
  </p>
</div>

</body>
</html>