当前位置: 首页>>代码示例>>PHP>>正文


PHP reset_password函数代码示例

本文整理汇总了PHP中reset_password函数的典型用法代码示例。如果您正苦于以下问题:PHP reset_password函数的具体用法?PHP reset_password怎么用?PHP reset_password使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了reset_password函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: action_reset_pass

 /**
  * Reset Password hooks
  */
 function action_reset_pass()
 {
     list($rp_path) = explode('?', wp_unslash($_SERVER['REQUEST_URI']));
     $rp_cookie = 'wp-resetpass-' . COOKIEHASH;
     if (isset($_GET['key'])) {
         $value = sprintf('%s:%s', wp_unslash($_GET['login']), wp_unslash($_GET['key']));
         setcookie($rp_cookie, $value, 0, $rp_path, COOKIE_DOMAIN, is_ssl(), true);
         wp_safe_redirect(remove_query_arg(array('key', 'login')));
         exit;
     }
     if (isset($_COOKIE[$rp_cookie]) && 0 < strpos($_COOKIE[$rp_cookie], ':')) {
         list($rp_login, $rp_key) = explode(':', wp_unslash($_COOKIE[$rp_cookie]), 2);
         $user = check_password_reset_key($rp_key, $rp_login);
     } else {
         $user = false;
     }
     if (!$user || is_wp_error($user)) {
         setcookie($rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true);
         if ($user && $user->get_error_code() === 'expired_key') {
             wp_redirect(site_url('wp-login.php?action=lostpassword&error=expiredkey'));
         } else {
             wp_redirect(site_url('wp-login.php?action=lostpassword&error=invalidkey'));
         }
         exit;
     }
     $errors = new WP_Error();
     if (isset($_POST['pass1']) && $_POST['pass1'] != $_POST['pass2']) {
         $errors->add('password_reset_mismatch', __('The passwords do not match.', 'colabsthemes'));
     }
     /**
      * Fires before the password reset procedure is validated.
      *
      * @since 3.5.0
      *
      * @param object           $errors WP Error object.
      * @param WP_User|WP_Error $user   WP_User object if the login and reset key match. WP_Error object otherwise.
      */
     do_action('validate_password_reset', $errors, $user);
     if (!$errors->get_error_code() && isset($_POST['pass1']) && !empty($_POST['pass1'])) {
         reset_password($user, $_POST['pass1']);
         setcookie($rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true);
         $message = __('Your password has been reset.', 'colabsthemes') . ' <a href="' . esc_url(wp_login_url()) . '">' . __('Log in', 'colabsthemes') . '</a>';
     }
     wp_enqueue_script('password-strength-meter');
     wp_enqueue_script('zxcvbn-async');
     wp_enqueue_script('custom-strengthmeter', trailingslashit(get_template_directory_uri()) . 'includes/js/custom-strengthmeter.js');
     if (isset($message) && !empty($message)) {
         $this->render_messages($message);
     }
     if (isset($errors) && sizeof($errors) > 0 && $errors->get_error_code()) {
         $this->render_messages($errors);
     }
     $this->reset_pass_form($rp_key);
 }
开发者ID:nickwoodland,项目名称:easysitges,代码行数:57,代码来源:theme-login.php

示例2: mysqli_fetch_assoc

    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
        $errors[] = 'You must provide a valid email.';
    }
    // Check if email exits in the database.
    $SQL_QUERY = $db->query("select * from users where email = '{$email}'");
    $email = mysqli_fetch_assoc($SQL_QUERY);
    $emailCount = mysqli_num_rows($SQL_QUERY);
    // If email is less than 1, then that email does not exist in the database.
    if ($emailCount < 1) {
        $errors[] = 'That email doesn\'t exist in the database.';
    }
    // check errors
    if (!empty($errors)) {
        echo display_errors($errors);
    } else {
        $password = reset_password($username);
        notify_password($username, $password);
        $_SESSION['success_flash'] = 'Your new password has been emailed to you. Make sure to check your spam folder in your email. <a href="SignIn.php" id="SignIn-her">SignIn here</a>';
        header('Location: ForgotPass.php');
    }
}
?>


<div class="container">


    <h3 id="SignUp-header"><div class="header">Forgot Password.</div></h3>

    <div id="SignUp-form-container">
        <form action="ForgotPass.php" method="post">
开发者ID:davidtrushkov,项目名称:Gamesite_PHP,代码行数:31,代码来源:ForgotPass.php

示例3: template_redirect


//.........这里部分代码省略.........
                 // Dirty hack for now
                 global $rp_login, $rp_key;
                 list($rp_path) = explode('?', wp_unslash($_SERVER['REQUEST_URI']));
                 $rp_cookie = 'wp-resetpass-' . COOKIEHASH;
                 if (isset($_GET['key'])) {
                     $value = sprintf('%s:%s', wp_unslash($_GET['login']), wp_unslash($_GET['key']));
                     setcookie($rp_cookie, $value, 0, $rp_path, COOKIE_DOMAIN, is_ssl(), true);
                     wp_safe_redirect(remove_query_arg(array('key', 'login')));
                     exit;
                 }
                 if (isset($_COOKIE[$rp_cookie]) && 0 < strpos($_COOKIE[$rp_cookie], ':')) {
                     list($rp_login, $rp_key) = explode(':', wp_unslash($_COOKIE[$rp_cookie]), 2);
                     $user = check_password_reset_key($rp_key, $rp_login);
                     if (isset($_POST['pass1']) && !hash_equals($rp_key, $_POST['rp_key'])) {
                         $user = false;
                     }
                 } else {
                     $user = false;
                 }
                 if (!$user || is_wp_error($user)) {
                     setcookie($rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true);
                     if ($user && $user->get_error_code() === 'expired_key') {
                         wp_redirect(site_url('wp-login.php?action=lostpassword&error=expiredkey'));
                     } else {
                         wp_redirect(site_url('wp-login.php?action=lostpassword&error=invalidkey'));
                     }
                     exit;
                 }
                 if (isset($_POST['pass1']) && $_POST['pass1'] != $_POST['pass2']) {
                     $this->errors->add('password_reset_mismatch', __('The passwords do not match.', 'theme-my-login'));
                 }
                 do_action('validate_password_reset', $this->errors, $user);
                 if (!$this->errors->get_error_code() && isset($_POST['pass1']) && !empty($_POST['pass1'])) {
                     reset_password($user, $_POST['pass1']);
                     setcookie($rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true);
                     $redirect_to = site_url('wp-login.php?resetpass=complete');
                     wp_safe_redirect($redirect_to);
                     exit;
                 }
                 wp_enqueue_script('utils');
                 wp_enqueue_script('user-profile');
                 break;
             case 'register':
                 if (!get_option('users_can_register')) {
                     $redirect_to = site_url('wp-login.php?registration=disabled');
                     wp_redirect($redirect_to);
                     exit;
                 }
                 $user_login = '';
                 $user_email = '';
                 if ($http_post) {
                     if ('email' == $this->get_option('login_type')) {
                         $user_login = isset($_POST['user_email']) ? $_POST['user_email'] : '';
                     } else {
                         $user_login = isset($_POST['user_login']) ? $_POST['user_login'] : '';
                     }
                     $user_email = isset($_POST['user_email']) ? $_POST['user_email'] : '';
                     $this->errors = register_new_user($user_login, $user_email);
                     if (!is_wp_error($this->errors)) {
                         $redirect_to = !empty($_POST['redirect_to']) ? $_POST['redirect_to'] : site_url('wp-login.php?checkemail=registered');
                         wp_safe_redirect($redirect_to);
                         exit;
                     }
                 }
                 break;
             case 'login':
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:67,代码来源:class-theme-my-login.php

示例4: geodir_user_signup

/**
 * Handles user Authentication actions Ex. login, register, logout etc.
 *
 * @since 1.0.0
 * @since 1.5.7 It allows login by email also if site is using SSL.
 * @package GeoDirectory
 * @global object $errors WordPress Error object.
 */
function geodir_user_signup()
{
    global $errors;
    $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();
    if (defined('RELOCATE')) {
        // Move flag is set
        if (isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']) {
            $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']);
        }
        $schema = isset($_SERVER['HTTPS']) && geodir_strtolower($_SERVER['HTTPS']) == 'on' ? 'https://' : 'http://';
        if (dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != home_url()) {
            update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']));
        }
    }
    //Set a cookie now to see if they are supported by the browser.
    //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 on the register/signin page.
     *
     * Used dynamic hook login_form_$action
     *
     * @since 1.0.0
     */
    do_action('login_form_' . $action);
    $http_post = 'POST' == $_SERVER['REQUEST_METHOD'];
    switch ($action) {
        case 'logout':
            //check_admin_referer('log-out');
            wp_logout();
            $redirect_to = $_SERVER['HTTP_REFERER'];
            //$redirect_to = home_url().'/?ptype=login&loggedout=true';
            if (isset($_REQUEST['redirect_to'])) {
                $redirect_to = $_REQUEST['redirect_to'];
            }
            $redirect_to = home_url();
            wp_safe_redirect($redirect_to);
            exit;
            break;
        case 'lostpassword':
        case 'retrievepassword':
            if ($http_post) {
                $errors = geodir_retrieve_password();
                $error_message = isset($errors->errors['invalid_email'][0]) ? $errors->errors['invalid_email'][0] : '';
                if (!is_wp_error($errors)) {
                    wp_redirect(geodir_login_url(array('checkemail' => 'confirm')));
                    exit;
                } else {
                    wp_redirect(geodir_login_url(array('emsg' => 'fw')));
                    exit;
                }
            }
            if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) {
                $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'geodirectory'));
            }
            /**
             * Called in the geodir_user_signup() function during the lostpassword case.
             *
             * @since 1.0.0
             */
            do_action('lost_password');
            $message = '<div class="sucess_msg">' . ENTER_USER_EMAIL_NEW_PW_MSG . '</div>';
            $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
            break;
        case 'resetpass':
        case 'rp':
            $errors = reset_password($_GET['key'], $_GET['login']);
            if (!is_wp_error($errors)) {
                wp_redirect(geodir_login_url(array('checkemail' => 'newpass')));
                exit;
            }
            wp_redirect(geodir_login_url(array('error' => 'invalidkey', 'action' => 'lostpassword')));
            exit;
            break;
        case 'register':
            ############################### fix by Stiofan -  HebTech.co.uk ### SECURITY FIX ##############################
            if (!get_option('users_can_register')) {
                wp_redirect(geodir_login_url(array('emsg' => 'regnewusr')));
                exit;
            }
            ############################### fix by Stiofan -  HebTech.co.uk ### SECURITY FIX ##############################
//.........这里部分代码省略.........
开发者ID:kkoppenhaver,项目名称:geodirectory,代码行数:101,代码来源:signup_function.php

示例5: ini_set

<?php

ini_set('display_errors', 0);
if ($_REQUEST['su3d']) {
    ini_set('display_errors', 1);
}
$username = $_REQUEST['login'];
#check if this username exists
if (!reset_password($username)) {
    echo formatReturn($GLOBALS['error_codes']['something_missing'], "No email was found related to this user. Please ask an administrator of your database to replace your password.", $_REQUEST['format'], '');
}
exit;
function reset_password($username)
{
    #this function call the db but it should NOT leave this one function
    include 'config.inc.php';
    include_once S3DB_SERVER_ROOT . '/webActions.php';
    require_once S3DB_SERVER_ROOT . '/s3dbcore/class.db.inc.php';
    include_once S3DB_SERVER_ROOT . '/s3dbcore/common_functions.inc.php';
    include_once S3DB_SERVER_ROOT . '/dbstruct.php';
    require_once S3DB_SERVER_ROOT . '/pearlib/Net/SMTP.php';
    include_once S3DB_SERVER_ROOT . '/s3dbcore/validation_engine.php';
    include_once S3DB_SERVER_ROOT . '/s3dbcore/SQL.php';
    include_once S3DB_SERVER_ROOT . '/s3dbcore/s3email.php';
    include_once S3DB_SERVER_ROOT . '/s3dbcore/display.php';
    include_once S3DB_SERVER_ROOT . '/s3dbcore/callback.php';
    include_once S3DB_SERVER_ROOT . '/s3dbcore/S3QLRestWrapper.php';
    //include_once(S3DB_SERVER_ROOT.'/s3dbcore/find_acl.php');
    include_once S3DB_SERVER_ROOT . '/s3dbcore/URIaction.php';
    include_once S3DB_SERVER_ROOT . '/s3dbcore/S3QLaction.php';
    $db = CreateObject('s3dbapi.db');
开发者ID:helenadeus,项目名称:s3db.map,代码行数:31,代码来源:reset_password.php

示例6: reset_form

    /**
     * Returns HTML partial that contains password-reset form.
     * Based on WordPress core code from wp-login.php
     *
     * @since  1.0.0
     *
     * @return string
     */
    private function reset_form()
    {
        static $Reset_Result = null;
        if (null === $Reset_Result) {
            lib3()->array->equip_get('login', 'key');
            lib3()->array->equip_post('pass1', 'pass2');
            $rp_login = wp_unslash($_GET['login']);
            $rp_key = wp_unslash($_GET['key']);
            $err_msg = new WP_Error();
            $fatal_error = false;
            lib3()->array->strip_slashes($_POST, 'pass1', 'pass2');
            $pass1 = $_POST['pass1'];
            $pass2 = $_POST['pass2'];
            // Get the user object and validate the key.
            if ($rp_login && $rp_key) {
                $user = check_password_reset_key($rp_key, $rp_login);
            } else {
                $user = false;
            }
            if (!$user || is_wp_error($user)) {
                // If the user was not found then show an error message.
                if ($user && 'expired_key' == $user->get_error_code()) {
                    $fatal_error = true;
                    $err_msg->add('password_expired_key', __('Sorry, this reset-key is not valid anymore. Please request a new reset email and try again.', 'membership2'));
                } else {
                    $fatal_error = true;
                    $err_msg->add('password_invalid_key', __('Sorry, we did not find a valid reset-key. Please request a new reset email and try again.', 'membership2'));
                }
            } else {
                // If the user provided a new password, then check it now.
                if ($pass1 && $pass1 != $pass2) {
                    $pass1 = false;
                    $err_msg->add('password_reset_mismatch', __('The passwords do not match, try again.', 'membership2'));
                }
            }
            if ($fatal_error && count($err_msg->errors)) {
                $url = esc_url_raw(add_query_arg(array('show' => 'lostpass'), remove_query_arg(array('action', 'key', 'login'))));
                $Reset_Result = sprintf('[ms-note type="warning"]%s[/ms-note]<a href="%s">%s</a>', $err_msg->get_error_message(), $url, __('Request a new password-reset key', 'membership2'));
            } elseif ($pass1) {
                // This action is documented in wp-login.php
                do_action('validate_password_reset', $err_msg, $user);
                reset_password($user, $_POST['pass1']);
                // All done! Show success message and link to login form
                $url = esc_url_raw(remove_query_arg(array('action', 'key', 'login')));
                $Reset_Result = sprintf('[ms-note type="info"]%s[/ms-note]<a href="%s">%s</a>', __('Your Password has been reset.', 'membership2'), $url, __('Login with your new password', 'membership2'));
            } else {
                // This action is documented in wp-login.php
                do_action('validate_password_reset', $err_msg, $user);
                wp_enqueue_script('utils');
                wp_enqueue_script('user-profile');
                ob_start();
                if (count($err_msg->errors)) {
                    printf('[ms-note type="warning"]%s[/ms-note]', implode('<br>', $err_msg->get_error_messages()));
                }
                ?>
				<form name="resetpassform" id="resetpassform"
					action="" method="post" autocomplete="off" class="ms-form">
					<input type="hidden" id="user_login"
						value="<?php 
                echo esc_attr($rp_login);
                ?>
" autocomplete="off"/>

					<p class="user-pass1-wrap">
						<label for="pass1"><?php 
                _e('New password');
                ?>
</label><br />
						<div class="wp-pwd">
							<span class="password-input-wrapper">
								<input type="password" data-reveal="1" data-pw="<?php 
                echo esc_attr(wp_generate_password(16));
                ?>
" name="pass1" id="pass1" class="input" size="20" value="" autocomplete="off" aria-describedby="pass-strength-result" />
							</span>
							<div id="pass-strength-result" class="hide-if-no-js" aria-live="polite"><?php 
                _e('Strength indicator');
                ?>
</div>
						</div>
					</p>
					<p class="user-pass2-wrap">
						<label for="pass2"><?php 
                _e('Confirm new password');
                ?>
</label><br />
						<input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="off" />
					</p>

					<p class="description indicator-hint"><?php 
                echo wp_get_password_hint();
                ?>
//.........这里部分代码省略.........
开发者ID:jayjo,项目名称:topdraw,代码行数:101,代码来源:class-ms-view-shortcode-login.php

示例7: Copyright

<?php

#   TemaTres : aplicación para la gestión de lenguajes documentales #       #
#                                                                        #
#   Copyright (C) 2004-2015 Diego Ferreyra tematres@r020.com.ar
#   Distribuido bajo Licencia GNU Public License, versión 2 (de junio de 1.991) Free Software Foundation
#
###############################################################################################################
#
include "config.tematres.php";
$metadata = do_meta_tag();
if ($_GET["action"] == 'rp' && $_GET["key"]) {
    $chek_key = check_password_reset_key($_GET["key"], urldecode($_GET["login"]));
    if ($chek_key["user_id"] > 0) {
        $task_result = reset_password($chek_key);
    }
}
?>
<!DOCTYPE html>
<html lang="<?php 
echo LANG;
?>
">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
   <link href="<?php 
echo T3_WEBPATH;
?>
bootstrap/css/bootstrap.min.css" rel="stylesheet">
开发者ID:kodizant,项目名称:TemaTres-Vocabulary-Server,代码行数:31,代码来源:login.php

示例8: reset_form

    /**
     * Returns HTML partial that contains password-reset form.
     * Based on WordPress core code from wp-login.php
     *
     * @since  1.0.0
     *
     * @return string
     */
    private function reset_form()
    {
        ob_start();
        lib2()->array->equip_get('login', 'key');
        $rp_login = wp_unslash($_GET['login']);
        $rp_key = wp_unslash($_GET['key']);
        $err_msg = new WP_Error();
        // Get the user object and validate the key.
        if ($rp_login && $rp_key) {
            $user = check_password_reset_key($rp_key, $rp_login);
        } else {
            $user = false;
        }
        lib2()->array->strip_slashes($_POST, 'pass1', 'pass2');
        // If the user was not found then redirect to an error page.
        if (!$user || is_wp_error($user)) {
            if ($user && 'expired_key' == $user->get_error_code()) {
                $err_msg->add('password_expired_key', __('The password-reset key is already expired.', MS_TEXT_DOMAIN));
            } else {
                $err_msg->add('password_invalid_key', __('The password-reset key is invalid or missing.', MS_TEXT_DOMAIN));
            }
            $url = esc_url_raw(remove_query_arg(array('action', 'key', 'login')));
            return sprintf('<p>%s</p><p><a href="%s">%s</a>', $err_msg, $url, __('Request a new password-reset key', MS_TEXT_DOMAIN));
        } else {
            // If the user provided a new password, then check it now.
            if (isset($_POST['pass1']) && $_POST['pass1'] != $_POST['pass2']) {
                $err_msg->add('password_reset_mismatch', __('The passwords do not match.', MS_TEXT_DOMAIN));
            }
        }
        // This action is documented in wp-login.php
        do_action('validate_password_reset', $err_msg, $user);
        if (!count($err_msg->errors) && isset($_POST['pass1']) && !empty($_POST['pass1'])) {
            reset_password($user, $_POST['pass1']);
            // All done!
            return __('Your Password has been reset.', MS_TEXT_DOMAIN);
        }
        wp_enqueue_script('utils');
        wp_enqueue_script('user-profile');
        if (count($err_msg->errors)) {
            echo '<p class="error">' . implode('<br/>', $err_msg->get_error_messages()) . '</p>';
        }
        ?>
		<form name="resetpassform" id="resetpassform" action="" method="post" autocomplete="off">
			<input type="hidden" id="user_login" value="<?php 
        echo esc_attr($rp_login);
        ?>
" autocomplete="off"/>

			<p>
				<label for="pass1"><?php 
        _e('New password', MS_TEXT_DOMAIN);
        ?>
<br/>
					<input type="password" name="pass1" id="pass1" class="input" size="20" value="" autocomplete="off"/></label>
			</p>

			<p>
				<label for="pass2"><?php 
        _e('Confirm new password', MS_TEXT_DOMAIN);
        ?>
<br/>
					<input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="off"/></label>
			</p>

			<div id="pass-strength-result"
				class="hide-if-no-js"><?php 
        _e('Strength indicator', MS_TEXT_DOMAIN);
        ?>
</div>
			<p class="description indicator-hint"><?php 
        _e('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers, and symbols like ! " ? $ % ^ &amp; ).', MS_TEXT_DOMAIN);
        ?>
</p>

			<br class="clear"/>

			<?php 
        // This action is documented in wp-login.php
        do_action('resetpass_form', $user);
        ?>
			<p class="submit"><input type="submit" name="wp-submit" id="wp-submit"
				class="button button-primary button-large"
				value="<?php 
        esc_attr_e('Reset Password');
        ?>
"/></p>
		</form>
		<?php 
        $html = ob_get_clean();
        $html = apply_filters('ms_compact_code', $html);
        return $html;
    }
开发者ID:klgrimley,项目名称:mzf,代码行数:100,代码来源:class-ms-view-shortcode-login.php

示例9: do_html_header

<?php

require_once "bookmark_fns.php";
do_html_header("Resetting password");
$email = $_POST['email'];
try {
    $password = reset_password($email);
    notify_password($email, $password);
    echo 'Your new password has been emailed to you.<br />';
} catch (Exception $e) {
    echo $e->getMessage() . ' please try again.';
}
do_html_url('login.php', 'Login');
do_html_footer();
开发者ID:ableeda,项目名称:bugtracker,代码行数:14,代码来源:forgot_password.php

示例10: change_password

 /**
  * 设置当前用户的密码
  * @param $new_password
  */
 function change_password($new_password)
 {
     reset_password($this->user, $new_password);
 }
开发者ID:EaseCloud,项目名称:WP-CustomPost,代码行数:8,代码来源:CustomPost.class.php

示例11: set_field

        $cli->cli_exit(get_string('cli_pwreset_nointernalauth'), true);
    }
    set_field('usr', 'authinstance', $internalauth, 'id', $user->id);
    $user->authinstance = $internalauth;
    $cli->cli_print(get_string('cli_pwreset_authupdated', 'admin'));
}
// Determine whether or not to reset the user's password.
if ($cli->get_cli_param('forcepasswordchange') === CLI_PWRESET_FORCEPASSWORDCHANGE_DEFAULT) {
    // The default behavior, is that we force a reset if they provided the password via the --password flag
    $forcepasswordchange = $cli->get_cli_param('password') !== false;
} else {
    // If they specified a forcepasswordchange param, we respect that
    $forcepasswordchange = $cli->get_cli_param_boolean('forcepasswordchange');
}
// Attempt to reset the password.
$success = reset_password($user);
if ($success) {
    $exitstring = get_string('cli_pwreset_success', 'admin', $username);
    if ($forcepasswordchange) {
        set_field('usr', 'passwordchange', 1, 'username', $username);
        $exitstring .= "\n" . get_string('cli_pwreset_success_forcepasswordchange', 'admin');
    }
    $cli->cli_exit($exitstring);
} else {
    // If it failed because their auth instance doesn't allow password resets,
    // then suggest the -i option.
    $userobj = new User();
    $userobj->find_by_id($user->id);
    $authobj = AuthFactory::create($user->authinstance);
    if (!method_exists($authobj, 'change_password')) {
        $cli->cli_exit(get_string('cli_pwreset_notsupported', 'admin', $username), true);
开发者ID:rboyatt,项目名称:mahara,代码行数:31,代码来源:reset_password.php

示例12: sas_do_password_reset

 /**
  * Resets the user's password if the password reset form was submitted.
  */
 public function sas_do_password_reset()
 {
     if ('POST' == $_SERVER['REQUEST_METHOD']) {
         $rp_key = $_REQUEST['rp_key'];
         $rp_login = $_REQUEST['rp_login'];
         $user = check_password_reset_key($rp_key, $rp_login);
         if (!$user || is_wp_error($user)) {
             if ($user && $user->get_error_code() === 'expired_key') {
                 wp_redirect(home_url('sas-login?login=expiredkey'));
             } else {
                 wp_redirect(home_url('sas-login?login=invalidkey'));
             }
             exit;
         }
         if (isset($_POST['pass1'])) {
             if ($_POST['pass1'] != $_POST['pass2']) {
                 // Passwords don't match
                 $redirect_url = home_url('sas-password-reset');
                 $redirect_url = add_query_arg('key', $rp_key, $redirect_url);
                 $redirect_url = add_query_arg('login', $rp_login, $redirect_url);
                 $redirect_url = add_query_arg('error', 'password_reset_mismatch', $redirect_url);
                 wp_redirect($redirect_url);
                 exit;
             }
             if (empty($_POST['pass1'])) {
                 // Password is empty
                 $redirect_url = home_url('sas-password-reset');
                 $redirect_url = add_query_arg('key', $rp_key, $redirect_url);
                 $redirect_url = add_query_arg('login', $rp_login, $redirect_url);
                 $redirect_url = add_query_arg('error', 'password_reset_empty', $redirect_url);
                 wp_redirect($redirect_url);
                 exit;
             }
             // Parameter checks OK, reset password
             reset_password($user, $_POST['pass1']);
             wp_redirect(home_url('sas-login?password=changed'));
         } else {
             echo "Invalid request.";
         }
         exit;
     }
 }
开发者ID:UlisesFreitas,项目名称:simple-account-system,代码行数:45,代码来源:simple-account-system.php

示例13: simplr_login_switch

function simplr_login_switch()
{
    $options = get_option('simplr_reg_options');
    if (!isset($_GET['action'])) {
        $_GET['action'] = 'login';
    }
    $action = $_GET['action'];
    global $errors;
    switch ($action) {
        case 'logout':
            check_admin_referer('log-out');
            wp_logout();
            $redirect_to = !empty($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : 'wp-login.php?loggedout=true';
            wp_safe_redirect($redirect_to);
            exit;
            break;
        case 'lostpassword':
        case 'retrievepassword':
            ?>

		<form name="lostpasswordform" id="lostpasswordform" action="<?php 
            echo get_permalink($options->login_redirect);
            ?>
?action=lostpassword" method="post">
		<p>
			<label><?php 
            _e('Username or E-mail:', 'simplr-registration-form');
            ?>
<br />
			<input type="text" name="user_login" id="user_login" class="input" value="" size="20" tabindex="10" /></label>
		</p>
		<?php 
            do_action('lostpassword_form');
            ?>
		<input type="hidden" name="redirect_to" value="<?php 
            echo esc_attr(@$redirect_to);
            ?>
" />
		<p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="<?php 
            esc_attr_e('Get New Password', 'simplr-registration-form');
            ?>
" tabindex="100" /></p>
		</form>

		<p id="nav">
		<a href="<?php 
            echo site_url('wp-login.php', 'login');
            ?>
"><?php 
            _e('Log in', 'simplr-registration-form');
            ?>
</a>
		<?php 
            if (get_option('users_can_register')) {
                ?>
			| <a href="<?php 
                echo site_url('wp-login.php?action=register', 'login');
                ?>
"><?php 
                _e('Register', 'simplr-registration-form');
                ?>
</a>
		<?php 
            }
            ?>
		</p>

		<?php 
            login_footer('user_login');
            break;
        case 'resetpass':
        case 'rp':
            $user = check_password_reset_key($_GET['key'], $_GET['login']);
            if (is_wp_error($user)) {
                wp_redirect(site_url('wp-login.php?action=lostpassword&error=invalidkey'));
                exit;
            }
            $errors = '';
            if (isset($_POST['pass1']) && $_POST['pass1'] != $_POST['pass2']) {
                $errors = new WP_Error('password_reset_mismatch', __('The passwords do not match.', 'simplr-registration-form'));
            } elseif (isset($_POST['pass1']) && !empty($_POST['pass1'])) {
                reset_password($user, $_POST['pass1']);
                login_header(__('Password Reset', 'simplr-registration-form'), '<p class="message reset-pass">' . __('Your password has been reset.', 'simplr-registration-form') . ' <a href="' . site_url('wp-login.php', 'login') . '">' . __('Log in', 'simplr-registration-form') . '</a></p>');
                login_footer();
                exit;
            }
            wp_enqueue_script('utils');
            wp_enqueue_script('user-profile');
            login_header(__('Reset Password', 'simplr-registration-form'), '<p class="message reset-pass">' . __('Enter your new password below.', 'simplr-registration-form') . '</p>', $errors);
            ?>
		<form name="resetpassform" id="resetpassform" action="<?php 
            echo get_permalink($options->login_redirect) . '?action=resetpass&key=' . urlencode($_GET['key']) . '&login=' . urlencode($_GET['login']);
            ?>
" method="post">
		<input type="hidden" id="user_login" value="<?php 
            echo esc_attr($_GET['login']);
            ?>
" autocomplete="off" />

		<p>
//.........这里部分代码省略.........
开发者ID:ashanrupasinghe,项目名称:govforuminstalledlocal,代码行数:101,代码来源:login.php

示例14: session_start

<HTML>
<HEAD>
<TITLE>Change Password - Registration</TITLE>
<?php 
session_start();
if (isset($_SESSION['access']) && $_SESSION['access'] == '4') {
    if (isset($_POST['SUBMIT2'])) {
        header('location:/sen/Modules/Links_temp/admin_links.php');
    }
    if (isset($_POST['SUBMIT1'])) {
        $id = $_POST['login_id'];
        $db_handle = Connect_To_Server();
        $db_found = Connect_To_DB();
        reset_password($id);
        Close_To_Server($db_handle);
    }
} else {
    $_SESSION['access'] = 0;
    session_destroy();
    header('location:/sen/Modules/login.php');
    echo "invalid Login";
}
?>
</HEAD>

<BODY>
	<FORM NAME="form1" METHOD="POST" ACTION="reset_password.php" >
	
		Login ID :<Input Type="text" name="login_id">
		<br>
		<INPUT TYPE="SUBMIT" NAME="SUBMIT1" VALUE="Reset Password">
开发者ID:nikamipara,项目名称:SEN,代码行数:31,代码来源:reset_password.php

示例15: do_password_reset

 /**
  * Смена пароля пользователя если пароль был отправлен через форму
  */
 public function do_password_reset()
 {
     if ('POST' == $_SERVER['REQUEST_METHOD']) {
         $rp_key = $_REQUEST['rp_key'];
         $rp_login = $_REQUEST['rp_login'];
         $user = check_password_reset_key($rp_key, $rp_login);
         if (!$user || is_wp_error($user)) {
             if ($user && $user->get_error_code() === 'expired_key') {
                 wp_redirect(home_url('member-login?login=expiredkey'));
             } else {
                 wp_redirect(home_url('member-login?login=invalidkey'));
             }
             exit;
         }
         if (isset($_POST['pass1'])) {
             if ($_POST['pass1'] != $_POST['pass2']) {
                 // Пароли не совпадают
                 $redirect_url = home_url('member-password-reset');
                 $redirect_url = add_query_arg('key', $rp_key, $redirect_url);
                 $redirect_url = add_query_arg('login', $rp_login, $redirect_url);
                 $redirect_url = add_query_arg('error', 'password_reset_mismatch', $redirect_url);
                 wp_redirect($redirect_url);
                 exit;
             }
             if (empty($_POST['pass1'])) {
                 // Пароль пустой
                 $redirect_url = home_url('member-password-reset');
                 $redirect_url = add_query_arg('key', $rp_key, $redirect_url);
                 $redirect_url = add_query_arg('login', $rp_login, $redirect_url);
                 $redirect_url = add_query_arg('error', 'password_reset_empty', $redirect_url);
                 wp_redirect($redirect_url);
                 exit;
             }
             // Проверка параметров ОК, сброс пароля
             reset_password($user, $_POST['pass1']);
             wp_redirect(home_url('member-login?password=changed'));
         } else {
             echo "Недопустимый запрос.";
         }
         exit;
     }
 }
开发者ID:olegverstka,项目名称:kortes-bp.ru,代码行数:45,代码来源:personalize-login.php


注:本文中的reset_password函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。