Example #1
0
function wiziapp_user_forgot_password()
{
    if (!empty($_POST)) {
        $_REQUEST['action'] = '';
        $_POST['user_login'] = $_REQUEST['user_login'];
        $_POST['user_email'] = $_REQUEST['user_email'];
        ob_start();
        require_once ABSPATH . 'wp-includes/registration.php';
        require_once ABSPATH . 'wp-login.php';
        ob_end_clean();
        $status = retrieve_password();
        if ($status === true) {
            //            $status = TRUE;
            $result = __("Success", 'wiziapp');
        } else {
            $result = implode('<br>', $status->get_error_messages());
            //            $status = FALSE;
        }
    } else {
        $result = '';
    }
    //    $header = array(
    //        'action' => 'forgot_password',
    //        'status' => $status,
    //        'code' => ($status) ? 200 : 4004,
    //        'message' => ($status) ? '' : 'Invalid forgot password',
    //    );
    return $result;
}
 /**
  * Send reset password email.
  *
  * @param array $validation_result The validation result.
  * @return mixed
  */
 public static function validation($validation_result)
 {
     $form = $validation_result['form'];
     $username = Utils::get_field_value($form, 'user_login');
     if (!empty($username)) {
         if (!function_exists('retrieve_password')) {
             ob_start();
             require_once ABSPATH . '/wp-login.php';
             ob_end_clean();
         }
         $_POST['user_login'] = $username;
         retrieve_password();
     }
     return $validation_result;
 }
function simplr_login_includes($post, $option, $file, $path)
{
    global $errors, $is_iphone, $interim_login, $current_site;
    $http_post = 'POST' == $_SERVER['REQUEST_METHOD'];
    $options = get_option('simplr_reg_options');
    global $wp;
    $action = @$_REQUEST['action'];
    if (@$_REQUEST['action'] == '') {
        wp_redirect('?action=login');
    }
    if (isset($options->login_redirect) and end($path) == $post->post_name) {
        switch ($action) {
            case 'lostpassword':
            case 'retrievepassword':
                if (isset($http_post)) {
                    $errors = retrieve_password();
                    if (!is_wp_error($errors)) {
                        $redirect_to = !empty($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : 'wp-login.php?checkemail=confirm';
                        wp_safe_redirect($redirect_to);
                        exit;
                    }
                }
                if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) {
                    $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'simplr-registration-form'));
                }
                $redirect_to = apply_filters('lostpassword_redirect', !empty($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '');
                do_action('lost_password');
                $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
                break;
            case 'login':
            case 'default':
                $secure_cookie = '';
                $interim_login = isset($_REQUEST['interim-login']);
                // If the user wants ssl but the session is not ssl, force a secure cookie.
                if (!empty($_POST['log']) && !force_ssl_admin()) {
                    $user_name = sanitize_user($_POST['log']);
                    if ($user = get_userdatabylogin($user_name)) {
                        if (get_user_option('use_ssl', $user->ID)) {
                            $secure_cookie = true;
                            force_ssl_admin(true);
                        }
                    }
                }
                if (isset($_REQUEST['redirect_to'])) {
                    $redirect_to = $_REQUEST['redirect_to'];
                    // Redirect to https if user wants ssl
                    if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin')) {
                        $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
                    }
                } else {
                    $redirect_to = admin_url();
                }
                $reauth = empty($_REQUEST['reauth']) ? false : true;
                // If the user was redirected to a secure login form from a non-secure admin page, and secure login is required but secure admin is not, then don't use a secure
                // cookie and redirect back to the referring non-secure admin page.  This allows logins to always be POSTed over SSL while allowing the user to choose visiting
                // the admin via http or https.
                if (!$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && 0 !== strpos($redirect_to, 'https') && 0 === strpos($redirect_to, 'http')) {
                    $secure_cookie = false;
                }
                $user = wp_signon('', $secure_cookie);
                $redirect_to = apply_filters('login_redirect', $redirect_to, isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '', $user);
                if (!is_wp_error($user) && !$reauth) {
                    if ($interim_login) {
                        $message = '<p class="message">' . __('You have logged in successfully.', 'simplr-registration-form') . '</p>';
                        ?>
						<script type="text/javascript">setTimeout( function(){window.close()}, 8000);</script>
						<p class="alignright">
						<input type="button" class="button-primary" value="<?php 
                        esc_attr_e('Close', 'simplr-registration-form');
                        ?>
" onclick="window.close()" /></p>
						</div></body></html>
				<?php 
                        exit;
                    }
                    if (empty($redirect_to) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url()) {
                        // If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile.
                        if (is_multisite() && !get_active_blog_for_user($user->id) && !is_super_admin($user->id)) {
                            $redirect_to = user_admin_url();
                        } elseif (is_multisite() && !$user->has_cap('read')) {
                            $redirect_to = get_dashboard_url($user->id);
                        } elseif (!$user->has_cap('edit_posts')) {
                            $redirect_to = admin_url('profile.php');
                        }
                    }
                    wp_safe_redirect($redirect_to);
                    exit;
                }
                $errors = $user;
                // Clear errors if loggedout is set.
                if (!empty($_GET['loggedout']) || $reauth) {
                    $errors = new WP_Error();
                }
                // If cookies are disabled we can't log in even with a valid user+pass
                if (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE])) {
                    $errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'simplr-registration-form'));
                }
                // Some parts of this script use the main login form to display a message
                if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) {
                    $errors->add('loggedout', __('You are now logged out.', 'simplr-registration-form'), 'message');
                } elseif (isset($_GET['registration']) && 'disabled' == $_GET['registration']) {
                    $errors->add('registerdisabled', __('User registration is currently not allowed.', 'simplr-registration-form'));
                } elseif (isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail']) {
                    $errors->add('confirm', __('Check your e-mail for the confirmation link.', 'simplr-registration-form'), 'message');
                } elseif (isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail']) {
                    $errors->add('newpass', __('Check your e-mail for your new password.', 'simplr-registration-form'), 'message');
                } elseif (isset($_GET['checkemail']) && 'registered' == $_GET['checkemail']) {
                    $errors->add('registered', __('Registration complete. Please check your e-mail.', 'simplr-registration-form'), 'message');
                } elseif ($interim_login) {
                    $errors->add('expired', __('Your session has expired. Please log-in again.', 'simplr-registration-form'), 'message');
                }
                // Clear any stale cookies.
                if ($reauth) {
                    wp_clear_auth_cookie();
                }
                break;
        }
    }
}
 /**
  * Initiates password reset
  */
 public function do_password_lost()
 {
     if ('POST' == $_SERVER['REQUEST_METHOD']) {
         $errors = retrieve_password();
         if (is_wp_error($errors)) {
             $redirect_url = $this->get_lostpassword_url();
             $redirect_url = add_query_arg('errors', join(',', $errors->get_error_codes()), $redirect_url);
         } else {
             $redirect_url = $this->get_login_url();
             $redirect_url = add_query_arg('checkemail', 'confirm', $redirect_url);
         }
         wp_redirect($redirect_url);
         exit;
     }
 }
Example #5
0
function app_show_password()
{
    $errors = new WP_Error();
    if (isset($_POST['user_login']) && $_POST['user_login']) {
        $errors = retrieve_password();
        if (!is_wp_error($errors)) {
            wp_redirect('wp-login.php?checkemail=confirm');
            exit;
        }
    }
    if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) {
        $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'appthemes'));
    }
    do_action('lost_password');
    do_action('lostpassword_post');
    if (file_exists(STYLESHEETPATH . '/header.php')) {
        include_once STYLESHEETPATH . '/header.php';
    } else {
        include_once TEMPLATEPATH . '/header.php';
    }
    ?>
	<!-- CONTENT -->
        <div class="content">

            <div class="content_botbg">

                <div class="content_res">

                    <!-- full block -->
                    <div class="shadowblock_out">

                        <div class="shadowblock">

                        <h2 class="dotted"><span class="colour"><?php 
    _e('Password Recovery', 'appthemes');
    ?>
</span></h2>
			
	   		
						<?php 
    if (isset($message) && !empty($message)) {
        echo '<p class="success">' . $message . '</p>';
    }
    ?>
						<?php 
    if ($errors && sizeof($errors) > 0 && $errors->get_error_code()) {
        echo '<ul class="errors">';
        foreach ($errors->errors as $error) {
            echo '<li>' . $error[0] . '</li>';
        }
        echo '</ul>';
    }
    ?>
						
						<p><?php 
    _e('Please enter your username or email address. A new password will be emailed to you.', 'appthemes');
    ?>
</p>
						
						<div class="left-box">						

							<?php 
    app_forgot_password_form();
    ?>

						</div>	
						
						<div class="right-box">
	
	
						</div><!-- /right-box -->				

						<div class="clr"></div>						

					</div><!-- /shadowblock -->

					</div><!-- /shadowblock_out -->


			  </div><!-- /content_res -->

			</div><!-- /content_botbg -->

		  </div><!-- /content -->

            
<?php 
    if (file_exists(STYLESHEETPATH . '/footer.php')) {
        include_once STYLESHEETPATH . '/footer.php';
    } else {
        include_once TEMPLATEPATH . '/footer.php';
    }
}
 public static function remember()
 {
     $return = array();
     //What we send back
     //if we're not on wp-login.php, we need to load it since retrieve_password() is located there
     if (!function_exists('retrieve_password')) {
         ob_start();
         include_once ABSPATH . 'wp-login.php';
         ob_clean();
     }
     $result = retrieve_password();
     if ($result === true) {
         //Password correctly remembered
         $return['result'] = true;
         $return['message'] = __("We have sent you an email", 'login-with-ajax');
     } elseif (strtolower(get_class($result)) == 'wp_error') {
         //Something went wrong
         /* @var $result WP_Error */
         $return['result'] = false;
         $return['error'] = $result->get_error_message();
     } else {
         //Undefined Error
         $return['result'] = false;
         $return['error'] = __('An undefined error has ocurred', 'login-with-ajax');
     }
     $return['action'] = 'remember';
     //Return the result array with errors etc.
     return $return;
 }
Example #7
0
     wp_logout();
     if (isset($_REQUEST['redirect_to'])) {
         $redirect_to = $_REQUEST['redirect_to'];
     } else {
         $redirect_to = $this->GetOption('logout_redirect');
     }
     if (empty($redirect_to)) {
         $redirect_to = get_bloginfo('siteurl') . '/wp-login.php?loggedout=true';
     }
     wp_safe_redirect($redirect_to);
     exit;
     break;
 case 'lostpassword':
 case 'retrievepassword':
     if ($http_post) {
         $login_errors = retrieve_password();
         if (!is_wp_error($login_errors)) {
             wp_redirect(simplelogin_url(array('checkemail' => 'confirm')));
             exit;
         }
     }
     if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) {
         $login_errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'simplelogin'));
     }
     break;
 case 'resetpass':
 case 'rp':
     $login_errors = reset_password($_GET['key']);
     if (!is_wp_error($login_errors)) {
         wp_redirect(simplelogin_url(array('action' => 'login', 'checkemail' => 'newpass')));
         exit;
 /**
  * Инициирует сброс пароля.
  */
 public function do_password_lost()
 {
     if ('POST' == $_SERVER['REQUEST_METHOD']) {
         $errors = retrieve_password();
         if (is_wp_error($errors)) {
             // Ошибки
             $redirect_url = home_url('member-password-lost');
             $redirect_url = add_query_arg('errors', join(',', $errors->get_error_codes()), $redirect_url);
         } else {
             // Отправка письма
             $redirect_url = home_url('member-login');
             $redirect_url = add_query_arg('checkemail', 'confirm', $redirect_url);
         }
         wp_redirect($redirect_url);
         exit;
     }
 }
 function remember()
 {
     $return = array();
     //What we send back
     $result = retrieve_password();
     if ($result === true) {
         //Password correctly remembered
         $return['result'] = true;
         $return['message'] = __("We have sent you an email", 'login-with-ajax');
     } elseif (strtolower(get_class($result)) == 'wp_error') {
         //Something went wrong
         /* @var $result WP_Error */
         $return['result'] = false;
         $return['error'] = $result->get_error_message();
     } else {
         //Undefined Error
         $return['result'] = false;
         $return['error'] = __('An undefined error has ocurred', 'login-with-ajax');
     }
     //Return the result array with errors etc.
     return $return;
 }
Example #10
0
function jr_show_password()
{
    $errors = new WP_Error();
    if (isset($_POST['user_login']) && $_POST['user_login']) {
        $errors = retrieve_password();
        if (!is_wp_error($errors)) {
            wp_redirect('wp-login.php?checkemail=confirm');
            exit;
        }
    }
    if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) {
        $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'appthemes'));
    }
    do_action('lost_password');
    do_action('lostpassword_post');
    get_template_part('header');
    ?>
	<div class="section">

    	<div class="section_content">
			
			<h1><?php 
    _e('Password Recovery', 'appthemes');
    ?>
</h1>
	   		
	   		<?php 
    if (isset($message) && !empty($message)) {
        echo '<p class="success">' . $message . '</p>';
    }
    ?>
	   		<?php 
    if ($errors && sizeof($errors) > 0 && $errors->get_error_code()) {
        echo '<ul class="errors">';
        foreach ($errors->errors as $error) {
            echo '<li>' . $error[0] . '</li>';
        }
        echo '</ul>';
    }
    ?>
	
	        <?php 
    jr_forgot_password_form();
    ?>

			<div class="clear"></div>
			
    	</div><!-- end section_content -->
	
		<div class="clear"></div>
	
	</div><!-- end section -->

        <div class="clear"></div>

</div><!-- end main content -->

<?php 
    if (get_option('jr_show_sidebar') !== 'no') {
        get_sidebar('page');
    }
    ?>


<?php 
    get_template_part('footer');
}
Example #11
0
function cyc_password()
{
    global $login;
    $login = 1;
    $errors = new WP_Error();
    if ($_POST['user_login']) {
        $errors = retrieve_password();
        if (!is_wp_error($errors)) {
            wp_redirect('wp-login.php?checkemail=confirm');
            exit;
        }
    }
    if ('invalidkey' == $_GET['error']) {
        $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.'));
    }
    $errors->add('registermsg', __('Пожалуйста введите логин или E-mail. Пароль будет отправлен вам на E-mail.'), 'message');
    do_action('lost_password');
    do_action('lostpassword_post');
    get_template_part('page', 'remind');
}
 /**
  * Initiates password reset.
  */
 public function do_password_lost()
 {
     if ('POST' == $_SERVER['REQUEST_METHOD']) {
         $errors = retrieve_password();
         if (is_wp_error($errors)) {
             // Errors found
             $redirect_url = home_url($this->pageSlug['member-password-lost']);
             $redirect_url = add_query_arg('errors', implode(',', $errors->get_error_codes()), $redirect_url);
         } else {
             // Email sent
             $redirect_url = home_url($this->pageSlug['member-login']);
             $redirect_url = add_query_arg('checkemail', 'confirm', $redirect_url);
         }
         wp_redirect($redirect_url);
         exit;
     }
 }
Example #13
0
function do_password_lost()
{
    if ('POST' == $_SERVER['REQUEST_METHOD']) {
        $errors = retrieve_password();
        if (is_wp_error($errors)) {
            // Errors found
            $redirect_url = home_url('forgot-password');
            $redirect_url = add_query_arg('errors', join(',', $errors->get_error_codes()), $redirect_url);
        } else {
            // Email sent
            $redirect_url = home_url('login');
            $redirect_url = add_query_arg('login', 'confirm', $redirect_url);
        }
        wp_redirect($redirect_url);
        exit;
    }
}
 switch ($data['action']) {
     case 'login':
         break;
     case 'lostpassword':
         //lost password link is hidden
         if (!isset($wpc_clients_staff['lost_password']) || 'yes' != $wpc_clients_staff['lost_password']) {
             do_action('wp_client_redirect', $this->cc_get_login_url());
             exit;
         }
         $data['error_msg'] = __('Please enter your username or email address. You will receive a link to create a new password via email.', WPC_CLIENT_TEXT_DOMAIN);
         if ('POST' == $_SERVER['REQUEST_METHOD']) {
             if (true === retrieve_password()) {
                 do_action('wp_client_redirect', add_query_arg(array('checkemail' => 'confirm'), $this->cc_get_login_url()));
                 exit;
             } else {
                 $data['error_msg'] = retrieve_password();
             }
         }
         $data['user_login'] = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
         break;
     case 'rp':
     case 'resetpass':
         //lost password link is hidden
         if (!isset($wpc_clients_staff['lost_password']) || 'yes' != $wpc_clients_staff['lost_password']) {
             do_action('wp_client_redirect', $this->cc_get_login_url());
             exit;
         }
         $user = wpc_check_password_reset_key($_GET['key'], $_GET['login']);
         if (is_string($user)) {
             $data['error_msg'] = $user;
         } else {
 /**
  * Initiates password reset.
  */
 public function sas_do_password_lost()
 {
     if ('POST' == $_SERVER['REQUEST_METHOD']) {
         $errors = retrieve_password();
         if (is_wp_error($errors)) {
             // Errors found
             $redirect_url = home_url('sas-password-lost');
             $redirect_url = add_query_arg('errors', join(',', $errors->get_error_codes()), $redirect_url);
         } else {
             // Email sent
             $redirect_url = home_url('sas-login');
             $redirect_url = add_query_arg('checkemail', 'confirm', $redirect_url);
             if (!empty($_REQUEST['redirect_to'])) {
                 $redirect_url = $_REQUEST['redirect_to'];
             }
         }
         wp_safe_redirect($redirect_url);
         exit;
     }
 }
<?php

/*
Template Name: _login_lpw
*/
define("DONOTCACHEPAGE", true);
if (is_user_logged_in()) {
    wp_redirect(home_url());
    exit;
}
if ($_POST['action'] && !wp_verify_nonce($_POST['nonce'], 'lost-password')) {
    die;
}
if ($_POST['action'] == 'pwreset') {
    $reset_status = retrieve_password();
}
if ($_GET['action'] == 'rp') {
    $user = check_password_reset_key($_GET['key'], $_GET['login']);
    if (is_wp_error($user)) {
        $invalid_key = 'invalid';
    }
}
if ($_POST['action'] == 'rp') {
    $rp_status = '';
    if ($_POST['pass1'] == '') {
        $rp_status = __('Password cannot be blank.', 'ipin');
    }
    if (strlen($_POST['password']) < 6) {
        $rp_status = __('Passwords must be at least 6 characters long.', 'ipin');
    }
    if ($_POST['pass1'] != $_POST['pass2']) {
function tja_lost_password($email)
{
    if (!get_user_by_email($email)) {
        return new WP_Error('unrognized-email');
    }
    $_POST['user_email'] = $email;
    $_POST['user_login'] = $email;
    //grab the retrieve password function from wp-login.php
    ob_start();
    include_once trailingslashit(ABSPATH) . 'wp-login.php';
    ob_end_clean();
    add_filter('retrieve_password_message', 'tja_lost_password_email', 10, 2);
    add_filter('wp_mail_content_type', 'wp_mail_content_type_html');
    $errors = retrieve_password();
    if (!is_wp_error($errors)) {
        return array('status' => 'success', 'text' => 'success');
    }
    tj_error_message('There was an unknown error', 'lost-password');
    return new WP_Error('unknown');
}
/**
 * Send the lost password email
 *
 * @param string $email
 * @return string on success, WP_Error on failure
 */
function hma_lost_password($email)
{
    if (!get_user_by_email($email) && !get_userdatabylogin($email)) {
        hm_error_message(apply_filters('hma_login_unrocognized_email_error_message', 'The email address you entered was not recognised'), 'lost-password');
        return new WP_Error('unrecognized-email');
    }
    $_POST['user_email'] = $email;
    $_POST['user_login'] = $email;
    // Grab the retrieve password function from wp-login.php
    ob_start();
    include_once trailingslashit(ABSPATH) . 'wp-login.php';
    ob_end_clean();
    add_filter('retrieve_password_message', 'hma_lost_password_email', 10, 2);
    add_filter('wp_mail_content_type', 'wp_mail_content_type_html');
    add_filter('wp_mail_from', 'hm_wp_mail_from');
    add_filter('wp_mail_from_name', 'hm_wp_mail_from_name');
    $errors = retrieve_password();
    if (!is_wp_error($errors)) {
        hm_success_message('You have been sent an email with a link to reset your password', 'lost-password');
        return array('status' => 'success', 'text' => 'success');
    }
    hm_error_message('There was an unknown error', 'lost-password');
    return new WP_Error('unknown');
}
Example #19
0
 /**
  * Lost Password hooks
  */
 function action_lostpassword()
 {
     $errors = new WP_Error();
     $http_post = 'POST' == $_SERVER['REQUEST_METHOD'];
     if ($http_post) {
         $errors = retrieve_password();
         if (!is_wp_error($errors)) {
             $redirect_to = !empty($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : 'wp-login.php?checkemail=confirm';
             wp_safe_redirect($redirect_to);
             exit;
         }
     }
     if (isset($_GET['error'])) {
         if ('invalidkey' == $_GET['error']) {
             $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'colabsthemes'));
         } elseif ('expiredkey' == $_GET['error']) {
             $errors->add('expiredkey', __('Sorry, that key has expired. Please try again.', 'colabsthemes'));
         }
     }
     $lostpassword_redirect = !empty($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '';
     /**
      * Filter the URL redirected to after submitting the lostpassword/retrievepassword form.
      *
      * @since 3.0.0
      *
      * @param string $lostpassword_redirect The redirect destination URL.
      */
     $redirect_to = apply_filters('lostpassword_redirect', $lostpassword_redirect);
     /**
      * Fires before the lost password form.
      *
      * @since 1.5.1
      */
     do_action('lost_password');
     $user_login = isset($_POST['user_login']) ? wp_unslash($_POST['user_login']) : '';
     // Error Messages
     $this->render_messages($errors);
     $this->forgot_password_form($redirect_to);
 }
Example #20
0
     /**
      * Filter the log out redirect URL.
      *
      * @since 4.2.0
      *
      * @param string  $redirect_to           The redirect destination URL.
      * @param string  $requested_redirect_to The requested redirect destination URL passed as a parameter.
      * @param WP_User $user                  The WP_User object for the user that's logging out.
      */
     $redirect_to = apply_filters('logout_redirect', $redirect_to, $requested_redirect_to, $user);
     wp_safe_redirect($redirect_to);
     exit;
 case 'lostpassword':
 case 'retrievepassword':
     if ($http_post) {
         $errors = retrieve_password();
         if (!is_wp_error($errors)) {
             $redirect_to = !empty($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : 'wp-login.php?checkemail=confirm';
             wp_safe_redirect($redirect_to);
             exit;
         }
     }
     if (isset($_GET['error'])) {
         if ('invalidkey' == $_GET['error']) {
             $errors->add('invalidkey', __('Your password reset link appears to be invalid. Please request a new link below.'));
         } elseif ('expiredkey' == $_GET['error']) {
             $errors->add('expiredkey', __('Your password reset link has expired. Please request a new link below.'));
         }
     }
     $lostpassword_redirect = !empty($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '';
     /**
Example #21
0
function cyc_password()
{
    $errors = new WP_Error();
    if ($_POST['user_login']) {
        $errors = retrieve_password();
        if (!is_wp_error($errors)) {
            wp_redirect('wp-login.php?checkemail=confirm');
            exit;
        }
    }
    if ('invalidkey' == $_GET['error']) {
        $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.'));
    }
    $errors->add('registermsg', __('Please enter your username or e-mail address. You will receive a new password via e-mail.'), 'message');
    do_action('lost_password');
    do_action('lostpassword_post');
    cyc_head("Lost Password");
    cyc_show_errors($errors);
    ?>
	<form class="loginform" name="lostpasswordform" id="lostpasswordform" action="<?php 
    echo site_url('wp-login.php?action=lostpassword', 'login_post');
    ?>
" method="post">
		<p>
			<label><?php 
    _e('Username or E-mail:');
    ?>
</label>
			<input type="text" name="user_login" id="user_login" class="input" value="<?php 
    echo attribute_escape(stripslashes($_POST['user_login']));
    ?>
" size="20" tabindex="10" />
		</p>
		<br/>
		<?php 
    do_action('lostpassword_form');
    ?>
		<p class="submit"><input type="submit" name="wp-submit" id="wp-submit" value="<?php 
    _e('Get New Password');
    ?>
" tabindex="100" /></p>
	</form>
<?php 
    cyc_footer();
}