本文整理汇总了PHP中retrieve_password函数的典型用法代码示例。如果您正苦于以下问题:PHP retrieve_password函数的具体用法?PHP retrieve_password怎么用?PHP retrieve_password使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了retrieve_password函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wiziapp_user_forgot_password
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;
}
示例2: validation
/**
* 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;
}
示例3: simplr_login_includes
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');
//.........这里部分代码省略.........
示例4: do_password_lost
/**
* 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;
}
}
示例5: app_show_password
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';
}
}
示例6: remember
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;
}
示例7: wp_logout
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;
示例8: do_password_lost
/**
* Инициирует сброс пароля.
*/
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;
}
}
示例9: remember
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;
}
示例10: jr_show_password
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');
}
示例11: cyc_password
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');
}
示例12: do_password_lost
/**
* 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;
}
}
示例13: do_password_lost
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;
}
}
示例14: switch
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 {
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:31,代码来源:login_form.php
示例15: sas_do_password_lost
/**
* 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;
}
}