4 * Request recovery of the lost password
6 * This page sends confirmation email with link to reset password
9 * SourceForge: Breaking Down the Barriers to Open Source Development
10 * Copyright 1999-2001 (c) VA Linux Systems
11 * http://sourceforge.net
18 require_once('pre.php');
22 $u = user_get_object_by_name($loginname);
24 if (!$u || !is_object($u)){
25 exit_error($Language->getText('account_lostpw','invalid_user'),$Language->getText('account_lostpw','user_dont_exist'));
28 // First, we need to create new confirm hash
30 $confirm_hash = md5($session_hash . strval(time()) . strval(rand()));
32 $u->setNewEmailAndHash($u->getEmail(), $confirm_hash);
34 exit_error('Error',$u->getErrorMessage());
37 $message = stripcslashes($Language->getText('account_lostpw', 'message', array($GLOBALS['HTTP_HOST'], $confirm_hash, $GLOBALS[sys_name])));
39 util_send_message($u->getEmail(),$Language->getText('account_lostpw', 'subject', $GLOBALS[sys_name]),$message);
41 $HTML->header(array('title'=>"Lost Password Confirmation",'pagename'=>'account_lostpw'));
43 echo $Language->getText('account_lostpw','notify');
45 $HTML->footer(array());
51 $HTML->header(array('title'=>"Lost Account Password",'pagename'=>'account_lostpw'));
53 echo $Language->getText('account_lostpw','warn');
56 <form action="<?php echo $PHP_SELF; ?>" method="post">
58 <?php echo $Language->getText('account_login', 'loginname'); ?>
60 <input type="text" name="loginname" />
63 <input type="submit" name="submit" value="<?php echo $Language->getText('account_lostpw','sendhash'); ?>" />
67 <p><a href="/"><?php echo $Language->getText('general', 'return', $GLOBALS[sys_name]); ?></a></p>
71 $HTML->footer(array());