Mail and reset fixes

git-svn-id: http://svn.automattic.com/wordpress/trunk@2236 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt 2005-02-07 06:43:23 +00:00
parent c4bc224fa9
commit faf873cbb6
2 changed files with 13 additions and 14 deletions

View File

@ -1570,13 +1570,13 @@ function htmlentities2($myHTML) {
function wp_mail($to, $subject, $message, $headers = '', $more = '') {
if( $headers == '' ) {
$headers = "MIME-Version: 1.0\n" .
"From: " . $to . " <" . $to . ">\n" .
"Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
}
if( $headers == '' ) {
$headers = "MIME-Version: 1.0\n" .
"Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
}
if ( function_exists('mb_send_mail') )
return mb_send_mail($to, $subject, $message, $headers, $more);
return mb_send_mail($to, $subject, $message, $headers, $more);
else
return mail($to, $subject, $message, $headers, $more);
}

View File

@ -103,7 +103,7 @@ case 'retrievepassword':
$message .= __('Login') . ": $user_login\r\n\r\n";
$message .= __("To reset your password visit the following address, otherwise just ignore this email and nothing will happen.\n\n");
$message .= get_settings('siteurl') . "/wp-login.php?action=resetpass&key=$key";
mail($user_email, sprintf(__("[%s] Password Reset"), get_settings('blogname')), $message);
$m = wp_mail($user_email, sprintf(__("[%s] Password Reset"), get_settings('blogname')), $message);
do_action('retreive_password', $user_login);
@ -128,9 +128,9 @@ case 'resetpass' :
if ( !$user )
die( __('Sorry, that key does not appear to be valid.') );
$new_pass = md5( substr( md5( uniqid( microtime() ) ), 0, 7) );
$wpdb->query("UPDATE $wpdb->users SET user_pass = '$new_pass', user_activation_key = '' WHERE user_login = '$user->user_login'");
$message = __('Login') . ": $user_login\r\n";
$new_pass = substr( md5( uniqid( microtime() ) ), 0, 7);
$wpdb->query("UPDATE $wpdb->users SET user_pass = MD5('$new_pass'), user_activation_key = '' WHERE user_login = '$user->user_login'");
$message = __('Login') . ": $user->user_login\r\n";
$message .= __('Password') . ": $new_pass\r\n";
$message .= get_settings('siteurl') . '/wp-login.php';
@ -145,11 +145,10 @@ case 'resetpass' :
} else {
echo '<p>' . sprintf(__("Your new password is in the mail."), $user_login) . '<br />';
echo "<a href='wp-login.php' title='" . __('Check your e-mail first, of course') . "'>" . __('Click here to login!') . '</a></p>';
die();
}
// send a copy of password change notification to the admin
wp_mail(get_settings('admin_email'), sprintf(__('[%s] Password Lost/Change'), get_settings('blogname')), sprintf(__('Password Lost and Changed for user: %s'), $user_login));
wp_mail(get_settings('admin_email'), sprintf(__('[%s] Password Lost/Change'), get_settings('blogname')), sprintf(__('Password Lost and Changed for user: %s'), $user->user_login));
die();
}
break;
case 'login' :