| 64 | | <h1><a href="http://<?php echo $current_site->domain . $current_site->path ?>"><?php echo $current_site->site_name ?></a></h1> |
|---|
| 65 | | <p><?php _e('Please enter your information here. We will send you a new password.') ?></p> |
|---|
| 66 | | <?php |
|---|
| 67 | | if ($error) |
|---|
| 68 | | echo "<div id='login_error'>$error</div>"; |
|---|
| | 47 | <h1><a href="<?php echo apply_filters('login_headerurl', 'http://' . $current_site->domain . $current_site->path ); ?>" title="<?php echo apply_filters('login_headertitle', $current_site->site_name ); ?>"><span class="hide"><?php bloginfo('name'); ?></span></a></h1> |
|---|
| | 48 | <?php |
|---|
| | 49 | if ( !empty( $message ) ) echo apply_filters('login_message', $message) . "\n"; |
|---|
| | 50 | |
|---|
| | 51 | // Incase a plugin uses $error rather than the $errors array |
|---|
| | 52 | if ( !empty( $error ) ) { |
|---|
| | 53 | $errors['error'] = $error; |
|---|
| | 54 | unset($error); |
|---|
| | 55 | } |
|---|
| | 56 | |
|---|
| | 57 | if ( !empty( $errors ) ) { |
|---|
| | 58 | if ( is_array( $errors ) ) { |
|---|
| | 59 | $newerrors = "\n"; |
|---|
| | 60 | foreach ( $errors as $error ) $newerrors .= ' ' . $error . "<br />\n"; |
|---|
| | 61 | $errors = $newerrors; |
|---|
| | 62 | } |
|---|
| | 63 | |
|---|
| | 64 | echo '<div id="login_error">' . apply_filters('login_errors', $errors) . "</div>\n"; |
|---|
| | 65 | echo "<p align='center'><strong>Note:</strong> You must <a style=\"color: #fff;\" href='http://www.google.com/cookies.html'>enable cookies</a> to use this site.</p>"; |
|---|
| | 66 | } |
|---|
| | 67 | } // End of login_header() |
|---|
| | 68 | |
|---|
| | 69 | |
|---|
| | 70 | switch ($action) { |
|---|
| | 71 | |
|---|
| | 72 | case 'logout' : |
|---|
| | 73 | |
|---|
| | 74 | wp_clearcookie(); |
|---|
| | 75 | do_action('wp_logout'); |
|---|
| | 76 | |
|---|
| | 77 | $redirect_to = 'wp-login.php?loggedout=true'; |
|---|
| | 78 | if ( isset( $_REQUEST['redirect_to'] ) ) |
|---|
| | 79 | $redirect_to = $_REQUEST['redirect_to']; |
|---|
| | 80 | |
|---|
| | 81 | wp_redirect($redirect_to); |
|---|
| | 82 | exit(); |
|---|
| | 83 | |
|---|
| | 84 | break; |
|---|
| | 85 | |
|---|
| | 86 | case 'lostpassword' : |
|---|
| | 87 | case 'retrievepassword' : |
|---|
| | 88 | $user_login = ''; |
|---|
| | 89 | $user_pass = ''; |
|---|
| | 90 | |
|---|
| | 91 | if ( $_POST ) { |
|---|
| | 92 | if ( empty( $_POST['user_login'] ) ) |
|---|
| | 93 | $errors['user_login'] = __('<strong>ERROR</strong>: The username field is empty.'); |
|---|
| | 94 | if ( empty( $_POST['user_email'] ) ) |
|---|
| | 95 | $errors['user_email'] = __('<strong>ERROR</strong>: The e-mail field is empty.'); |
|---|
| | 96 | |
|---|
| | 97 | do_action('lostpassword_post'); |
|---|
| | 98 | |
|---|
| | 99 | if ( empty( $errors ) ) { |
|---|
| | 100 | $user_data = get_userdatabylogin(trim($_POST['user_login'])); |
|---|
| | 101 | // redefining user_login ensures we return the right case in the email |
|---|
| | 102 | $user_login = $user_data->user_login; |
|---|
| | 103 | $user_email = $user_data->user_email; |
|---|
| | 104 | |
|---|
| | 105 | if (!$user_email || $user_email != $_POST['user_email']) { |
|---|
| | 106 | $errors['invalidcombo'] = __('<strong>ERROR</strong>: Invalid username / e-mail combination.'); |
|---|
| | 107 | } else { |
|---|
| | 108 | do_action('retreive_password', $user_login); // Misspelled and deprecated |
|---|
| | 109 | do_action('retrieve_password', $user_login); |
|---|
| | 110 | |
|---|
| | 111 | // Generate something random for a password... md5'ing current time with a rand salt |
|---|
| | 112 | $key = substr( md5( uniqid( microtime() ) ), 0, 8); |
|---|
| | 113 | // Now insert the new pass md5'd into the db |
|---|
| | 114 | $wpdb->query("UPDATE $wpdb->users SET user_activation_key = '$key' WHERE user_login = '$user_login'"); |
|---|
| | 115 | $message = __('Someone has asked to reset the password for the following site and username.') . "\r\n\r\n"; |
|---|
| | 116 | $message .= get_option('siteurl') . "\r\n\r\n"; |
|---|
| | 117 | $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; |
|---|
| | 118 | $message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\r\n\r\n"; |
|---|
| | 119 | $message .= get_option('siteurl') . "/wp-login.php?action=rp&key=$key\r\n"; |
|---|
| | 120 | |
|---|
| | 121 | if (FALSE == wp_mail($user_email, sprintf(__('[%s] Password Reset'), get_option('blogname')), $message)) { |
|---|
| | 122 | die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>'); |
|---|
| | 123 | } else { |
|---|
| | 124 | wp_redirect('wp-login.php?checkemail=confirm'); |
|---|
| | 125 | exit(); |
|---|
| | 126 | } |
|---|
| | 127 | } |
|---|
| | 128 | } |
|---|
| | 129 | } |
|---|
| | 130 | |
|---|
| | 131 | if ( 'invalidkey' == $_GET['error'] ) $errors['invalidkey'] = __('Sorry, that key does not appear to be valid.'); |
|---|
| | 132 | |
|---|
| | 133 | do_action('lost_password'); |
|---|
| | 134 | login_header(__('Lost Password'), '<p class="message">' . __('Please enter your username and e-mail address. You will recieve a new password via e-mail.') . '</p>'); |
|---|
| 71 | | <form name="lostpass" action="wp-login.php" method="post" id="lostpass"> |
|---|
| 72 | | <p> |
|---|
| 73 | | <input type="hidden" name="action" value="retrievepassword" /> |
|---|
| 74 | | <label><?php _e('Username:') ?><br /> |
|---|
| 75 | | <input type="text" name="user_login" id="user_login" value="" size="20" tabindex="1" /></label></p> |
|---|
| 76 | | <p><label><?php _e('E-mail:') ?><br /> |
|---|
| 77 | | <input type="text" name="email" id="email" value="" size="25" tabindex="2" /></label><br /> |
|---|
| 78 | | </p> |
|---|
| 79 | | <p class="submit"><input type="submit" name="submit" id="submit" value="<?php _e('Retrieve Password »'); ?>" tabindex="3" /></p> |
|---|
| | 137 | <form name="lostpasswordform" id="lostpasswordform" action="wp-login.php?action=lostpassword" method="post"> |
|---|
| | 138 | <p> |
|---|
| | 139 | <label><?php _e('Username:') ?><br /> |
|---|
| | 140 | <input type="text" name="user_login" id="user_login" class="input" value="<?php echo wp_specialchars(stripslashes($_POST['user_login']), 1); ?>" size="20" tabindex="10" /></label> |
|---|
| | 141 | </p> |
|---|
| | 142 | <p> |
|---|
| | 143 | <label><?php _e('E-mail:') ?><br /> |
|---|
| | 144 | <input type="text" name="user_email" id="user_email" class="input" value="<?php echo wp_specialchars(stripslashes($_POST['user_email']), 1); ?>" size="25" tabindex="20" /></label> |
|---|
| | 145 | </p> |
|---|
| | 146 | <?php do_action('lostpassword_form'); ?> |
|---|
| | 147 | <p class="submit"><input type="submit" name="submit" id="submit" value="<?php _e('Get New Password »'); ?>" tabindex="100" /></p> |
|---|
| 94 | | case 'retrievepassword': |
|---|
| 95 | | $user_data = get_userdatabylogin(trim($_POST['user_login'])); |
|---|
| 96 | | // redefining user_login ensures we return the right case in the email |
|---|
| 97 | | $user_login = $user_data->user_login; |
|---|
| 98 | | $user_email = $user_data->user_email; |
|---|
| 99 | | |
|---|
| 100 | | if (!$user_email || $user_email != $_POST['email']) |
|---|
| 101 | | wp_die(sprintf(__('Sorry, that user does not seem to exist in our database. Perhaps you have the wrong username or e-mail address? <a href="%s">Try again</a>.'), 'wp-login.php?action=lostpassword')); |
|---|
| 102 | | |
|---|
| 103 | | do_action('retreive_password', $user_login); // Misspelled and deprecated. |
|---|
| 104 | | do_action('retrieve_password', $user_login); |
|---|
| 105 | | |
|---|
| 106 | | // Generate something random for a password... md5'ing current time with a rand salt |
|---|
| 107 | | $key = substr( md5( uniqid( microtime() ) ), 0, 8); |
|---|
| 108 | | // now insert the new pass md5'd into the db |
|---|
| 109 | | $wpdb->query("UPDATE $wpdb->users SET user_activation_key = '$key' WHERE user_login = '$user_login'"); |
|---|
| 110 | | $message = __('Someone has asked to reset the password for the following site and username.') . "\r\n\r\n"; |
|---|
| 111 | | $message .= get_option('siteurl') . "\r\n\r\n"; |
|---|
| 112 | | $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; |
|---|
| 113 | | $message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\r\n\r\n"; |
|---|
| 114 | | $message .= get_option('siteurl') . "/wp-login.php?action=rp&key=$key\r\n"; |
|---|
| 115 | | |
|---|
| 116 | | $m = wp_mail($user_email, sprintf(__('[%s] Password Reset'), get_option('blogname')), $message); |
|---|
| 117 | | |
|---|
| 118 | | if ($m == false) { |
|---|
| 119 | | echo '<p>' . __('The e-mail could not be sent.') . "<br />\n"; |
|---|
| 120 | | echo __('Possible reason: your host may have disabled the mail() function...') . "</p>"; |
|---|
| 121 | | die(); |
|---|
| 122 | | } else { |
|---|
| 123 | | echo '<p>' . sprintf(__("The e-mail was sent successfully to %s's e-mail address."), $user_login) . '<br />'; |
|---|
| 124 | | echo "<a href='wp-login.php' title='" . __('Check your e-mail first, of course') . "'>" . __('Click here to login!') . '</a></p>'; |
|---|
| 125 | | die(); |
|---|
| 126 | | } |
|---|
| 127 | | |
|---|
| 128 | | break; |
|---|
| 129 | | |
|---|
| 208 | | $error = __('Your session has expired.'); |
|---|
| 209 | | } |
|---|
| 210 | | } else if ( $user_login || $user_pass ) { |
|---|
| 211 | | $error = __('<strong>Error</strong>: The password field is empty.'); |
|---|
| 212 | | } |
|---|
| | 243 | $errors['expiredsession'] = __('Your session has expired.'); |
|---|
| | 244 | } |
|---|
| | 245 | } |
|---|
| | 246 | |
|---|
| | 247 | if ( $_POST && empty( $user_login ) ) |
|---|
| | 248 | $errors['user_login'] = __('<strong>ERROR</strong>: The username field is empty.'); |
|---|
| | 249 | if ( $_POST && empty( $user_pass ) ) |
|---|
| | 250 | $errors['user_pass'] = __('<strong>ERROR</strong>: The password field is empty.'); |
|---|
| | 251 | |
|---|
| | 252 | // Some parts of this script use the main login form to display a message |
|---|
| | 253 | if ( TRUE == $_GET['loggedout'] ) $errors['loggedout'] = __('Successfully logged you out.'); |
|---|
| | 254 | elseif ( 'disabled' == $_GET['registration'] ) $errors['registerdiabled'] = __('User registration is currently not allowed.'); |
|---|
| | 255 | elseif ( 'confirm' == $_GET['checkemail'] ) $errors['confirm'] = __('Check your e-mail for the confirmation link.'); |
|---|
| | 256 | elseif ( 'newpass' == $_GET['checkemail'] ) $errors['newpass'] = __('Check your e-mail for your new password.'); |
|---|
| | 257 | elseif ( 'registered' == $_GET['checkemail'] ) $errors['registered'] = __('Registration complete. Please check your e-mail.'); |
|---|
| 242 | | <p><label><?php _e('Username:') ?><br /><input type="text" name="log" id="log" value="<?php echo wp_specialchars(stripslashes($user_login), 1); ?>" size="20" tabindex="1" /></label></p> |
|---|
| 243 | | <p><label><?php _e('Password:') ?><br /> <input type="password" name="pwd" id="pwd" value="" size="20" tabindex="2" /></label></p> |
|---|
| 244 | | <p> |
|---|
| 245 | | <label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="3" /> |
|---|
| 246 | | <?php _e('Remember me'); ?></label></p> |
|---|
| 247 | | <p class="submit"> |
|---|
| 248 | | <input type="submit" name="submit" id="submit" value="<?php _e('Login'); ?> »" tabindex="4" /> |
|---|
| 249 | | <input type="hidden" name="redirect_to" value="<?php echo wp_specialchars($redirect_to); ?>" /> |
|---|
| 250 | | </p> |
|---|
| | 265 | <p> |
|---|
| | 266 | <label><?php _e('Username:') ?><br /> |
|---|
| | 267 | <input type="text" name="user_login" id="user_login" class="input" value="<?php echo wp_specialchars(stripslashes($user_login), 1); ?>" size="20" tabindex="10" /></label> |
|---|
| | 268 | </p> |
|---|
| | 269 | <p> |
|---|
| | 270 | <label><?php _e('Password:') ?><br /> |
|---|
| | 271 | <input type="password" name="user_pass" id="user_pass" class="input" value="" size="20" tabindex="20" /></label> |
|---|
| | 272 | </p> |
|---|
| | 273 | <?php do_action('login_form'); ?> |
|---|
| | 274 | <p><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90" /> <?php _e('Remember me'); ?></label></p> |
|---|
| | 275 | <p class="submit"> |
|---|
| | 276 | <input type="submit" name="submit" id="submit" value="<?php _e('Login'); ?> »" tabindex="100" /> |
|---|
| | 277 | <input type="hidden" name="redirect_to" value="<?php echo wp_specialchars($redirect_to); ?>" /> |
|---|
| | 278 | </p> |
|---|