diff --git a/wp-login.php b/wp-login.php
index 43abadde7a..bf3a9d2ec4 100644
--- a/wp-login.php
+++ b/wp-login.php
@@ -147,8 +147,13 @@ function retrieve_password() {
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
$message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\r\n\r\n";
$message .= site_url("wp-login.php?action=rp&key=$key", 'login') . "\r\n";
-
- if ( !wp_mail($user_email, sprintf(__('[%s] Password Reset'), get_option('blogname')), $message) )
+
+ $title = sprintf(__('[%s] Password Reset'), get_option('blogname'));
+
+ $title = apply_filters('retrieve_password_title', $title);
+ $message = apply_filters('retrieve_password_message', $message, $key);
+
+ if ( $message && !wp_mail($user_email, $title, $message) )
die('
' . __('The e-mail could not be sent.') . "
\n" . __('Possible reason: your host may have disabled the mail() function...') . '
');
return true;
@@ -174,18 +179,24 @@ function reset_password($key) {
if ( empty( $user ) )
return new WP_Error('invalid_key', __('Invalid key'));
- do_action('password_reset', $user);
-
// Generate something random for a password...
$new_pass = wp_generate_password();
+
+ do_action('password_reset', $user, $new_pass);
+
wp_set_password($new_pass, $user->ID);
update_usermeta($user->ID, 'default_password_nag', true); //Set up the Password change nag.
$message = sprintf(__('Username: %s'), $user->user_login) . "\r\n";
$message .= sprintf(__('Password: %s'), $new_pass) . "\r\n";
$message .= site_url('wp-login.php', 'login') . "\r\n";
- if ( !wp_mail($user->user_email, sprintf(__('[%s] Your new password'), get_option('blogname')), $message) )
- die('' . __('The e-mail could not be sent.') . "
\n" . __('Possible reason: your host may have disabled the mail() function...') . '
');
+ $title = sprintf(__('[%s] Your new password'), get_option('blogname'));
+
+ $title = apply_filters('password_reset_title', $title);
+ $message = apply_filters('password_reset_message', $message, $new_pass);
+
+ if ( $message && !wp_mail($user->user_email, $title, $message) )
+ die('' . __('The e-mail could not be sent.') . "
\n" . __('Possible reason: your host may have disabled the mail() function...') . '
');
wp_password_change_notification($user);
@@ -246,12 +257,16 @@ function register_new_user($user_login, $user_email) {
// Main
//
-$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
+$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'login';
$errors = new WP_Error();
if ( isset($_GET['key']) )
$action = 'resetpass';
+// validate action so as to default to the login screen
+if ( !in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_' . $action) )
+ $action = 'login';
+
nocache_headers();
header('Content-Type: '.get_bloginfo('html_type').'; charset='.get_bloginfo('charset'));
@@ -270,6 +285,9 @@ setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
if ( SITECOOKIEPATH != COOKIEPATH )
setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
+// allow plugins to override the default actions, and to add extra actions if they want
+do_action('login_form_' . $action);
+
$http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
switch ($action) {
@@ -517,4 +535,4 @@ try{document.getElementById('user_login').focus();}catch(e){}
break;
} // end action switch
-?>
+?>
\ No newline at end of file