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


PHP wp_authenticate_username_password函数代码示例

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


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

示例1: login_with_email_address

function login_with_email_address($user, $username, $password)
{
    $user = get_user_by('email', $username);
    if (!empty($user->user_login)) {
        $username = $user->user_login;
    }
    return wp_authenticate_username_password(null, $username, $password);
}
开发者ID:subhadip-sahoo,项目名称:wp-projectSUB,代码行数:8,代码来源:theme-actions.php

示例2: bcs_el_login_with_email

function bcs_el_login_with_email($user, $username, $password)
{
    if (is_email($username)) {
        $user = get_user_by_email($username);
        if ($user) {
            $username = $user->user_login;
        }
    }
    return wp_authenticate_username_password(null, $username, $password);
}
开发者ID:ChristianWhiting,项目名称:DIY,代码行数:10,代码来源:email_login.php

示例3: bainternet_allow_email_login

function bainternet_allow_email_login($user, $username, $password)
{
    if (is_email($username)) {
        $user = get_user_by('email', $username);
        if ($user) {
            $username = $user->user_login;
        }
    }
    return wp_authenticate_username_password(null, $username, $password);
}
开发者ID:nengineer,项目名称:WP-Anatomy,代码行数:10,代码来源:shortcodes.php

示例4: authenticate

 public static function authenticate($user, $username, $password)
 {
     if (is_email($username)) {
         $user = get_user_by('email', $username);
         if ($user) {
             $username = $user->user_login;
         }
     }
     return wp_authenticate_username_password(null, $username, $password);
 }
开发者ID:ClayMoreBoy,项目名称:wp-theme-inn2015v2,代码行数:10,代码来源:login-with-email.php

示例5: moove_email_login_filter

 /**
  * Enable login with e-mail address
  *
  * @param  obj    $user     WP User.
  * @param  string $username WP User username.
  * @param  string $password Passeword.
  * @return boolean True/false after authentification
  */
 function moove_email_login_filter($user, $username, $password)
 {
     if (is_email($username)) {
         $user = get_user_by('email', $username);
         if ($user) {
             $username = $user->user_login;
         }
     }
     return wp_authenticate_username_password(null, $username, $password);
 }
开发者ID:MooveAgency,项目名称:Post-Protection-and-Registration-Wall,代码行数:18,代码来源:moove-user-settings.php

示例6: dr_email_login_authenticate

/**
 * If an email address is entered in the username box, then look up the matching username and authenticate as per normal, using that.
 *
 * @param string $user
 * @param string $username
 * @param string $password
 * @return Results of autheticating via wp_authenticate_username_password(), using the username found when looking up via email.
 */
function dr_email_login_authenticate($user, $username, $password)
{
    if (is_a($user, 'WP_User')) {
        return $user;
    }
    if (!empty($username)) {
        $username = str_replace('&', '&', stripslashes($username));
        $user = get_user_by('email', $username);
        if (isset($user, $user->user_login, $user->user_status) && 0 == (int) $user->user_status) {
            $username = $user->user_login;
        }
    }
    return wp_authenticate_username_password(null, $username, $password);
}
开发者ID:donwea,项目名称:nhap.org,代码行数:22,代码来源:email-login.php

示例7: my_authenticate_username_password

function my_authenticate_username_password($user, $username, $password)
{
    // If an email address is entered in the username box,
    // then look up the matching username and authenticate as per normal, using that.
    if (!empty($username)) {
        //if the username is not email set username to blank string
        //causes authenticate to fail
        if (!filter_var($username, FILTER_VALIDATE_EMAIL)) {
            $username = time();
        }
        $user = get_user_by('email', $username);
    }
    if (isset($user->user_login, $user)) {
        $username = $user->user_login;
    }
    // using the username found when looking up via email
    return wp_authenticate_username_password(NULL, $username, $password);
}
开发者ID:xfalcons,项目名称:wordpress-youmeifd,代码行数:18,代码来源:wp-must-use-email-to-login.php

示例8: authenticate

 public function authenticate($user, $username, $password)
 {
     if (is_a($user, 'WP_User')) {
         return $user;
     }
     if (!empty($username) && is_email($username)) {
         $user = get_user_by('email', $username);
         if (isset($user, $user->user_login, $user->user_status)) {
             if (0 === intval($user->user_status)) {
                 $username = $user->user_login;
                 return wp_authenticate_username_password(null, $username, $password);
             }
         }
     }
     if (!empty($username) || !empty($password)) {
         return false;
     } else {
         return wp_authenticate_username_password(null, "", "");
     }
 }
开发者ID:KansaiOpenDataActivityList,项目名称:expo15.theodi.jp,代码行数:20,代码来源:force-email-login.php

示例9: crowdx_fallBackLogin

 function crowdx_fallBackLogin()
 {
     if ($this->options['all_users'] == 0) {
         //check metadata on this user
         $user = get_user_by('login', sanitize_user($_POST['log']));
         $crowd = get_user_meta($user->ID, 'crowdx', true);
         if ($crowd == false) {
             remove_action('authenticate', 'wp_authenticate_username_password', 20);
             return false;
         }
         //allow to login below
     }
     $rem = $_POST['rememberme'] == 'forever' ? true : false;
     $secure = $_SERVER["SERVER_PORT"] == "443" ? true : false;
     $userArray = array('user_login' => $_POST['log'], 'user_password' => $_POST['pwd'], 'remember' => $rem);
     $user = wp_authenticate_username_password('', $_POST['log'], $_POST['pwd']);
     if (is_wp_error($user)) {
         remove_action('authenticate', 'wp_authenticate_username_password', 20);
         return false;
     }
     return true;
 }
开发者ID:laiello,项目名称:suitex,代码行数:22,代码来源:crowdx_functions.php

示例10: tfaVerifyCodeAndUser

function tfaVerifyCodeAndUser($user, $username, $password)
{
    $installed_version = get_option('tfa_version');
    if ($installed_version < 4) {
        return $user;
    }
    $tfa = getTFAClass();
    if (is_wp_error($user)) {
        return $user;
    }
    $params = $_POST;
    $params['log'] = $username;
    $params['caller'] = $_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['REQUEST_URI'];
    $code_ok = $tfa->authUserFromLogin($params);
    if (!$code_ok) {
        return new WP_Error('authentication_failed', __('<strong>ERROR</strong>: The Two Factor Code you entered was incorrect.', TFA_TEXT_DOMAIN));
    }
    if ($user) {
        return $user;
    }
    return wp_authenticate_username_password(null, $username, $password);
}
开发者ID:amep-lotus,项目名称:wp01,代码行数:22,代码来源:two-factor-login.php

示例11: rublon2factor_authenticate

function rublon2factor_authenticate($user, $username, $password)
{
    $user = wp_authenticate_username_password($user, $username, $password);
    if (is_wp_error($user)) {
        return $user;
    } else {
        do_action('rublon_pre_authenticate', $user);
        $user_id = RublonHelper::getUserId($user);
        if (is_user_member_of_blog($user_id) && RublonHelper::isSiteRegistered()) {
            wp_logout();
            $remember = !empty($_POST['rememberme']);
            $authURL = RublonHelper::authenticateWithRublon($user, $remember);
            if (empty($authURL)) {
                if (RublonHelper::canShowBusinessEditionUpgradeBoxAfterLogin($user)) {
                    RublonHelper::setMessage('BUSINESS_EDITION_UPGRADE_BOX', 'updated', 'RC');
                }
                $levels = RublonRolesProtection::getProtectionTypesLevels();
                if ($levels[RublonHelper::getUserProtectionType()] >= $levels[RublonHelper::PROTECTION_TYPE_MOBILE]) {
                    $user_email = RublonHelper::getUserEmail($user);
                    $obfuscated_email = RublonHelper::obfuscateEmail($user_email);
                    RublonHelper::setMessage('ROLE_BLOCKED|' . base64_encode($obfuscated_email), 'error', 'LM');
                    $return_page = RublonHelper::getReturnPage();
                    wp_safe_redirect(wp_login_url($return_page));
                    exit;
                } else {
                    RublonHelper::setMobileUserStatus($user, RublonHelper::NO);
                    return $user;
                }
            } else {
                RublonHelper::setLoginToken($user);
                wp_redirect($authURL);
                exit;
            }
        } else {
            return $user;
        }
    }
}
开发者ID:khanhnd91,项目名称:khaosan,代码行数:38,代码来源:rublon2factor_hooks.php

示例12: um_wp_form_errors_hook_logincheck

function um_wp_form_errors_hook_logincheck($user, $username, $password)
{
    remove_filter('authenticate', 'wp_authenticate_username_password', 20, 3);
    if (isset($user->ID)) {
        um_fetch_user($user->ID);
        $status = um_user('account_status');
        switch ($status) {
            case 'inactive':
                return new WP_Error($status, __('Your account has been disabled.', 'ultimatemember'));
                break;
            case 'awaiting_admin_review':
                return new WP_Error($status, __('Your account has not been approved yet.', 'ultimatemember'));
                break;
            case 'awaiting_email_confirmation':
                return new WP_Error($status, __('Your account is awaiting e-mail verification.', 'ultimatemember'));
                break;
            case 'rejected':
                return new WP_Error($status, __('Your membership request has been rejected.', 'ultimatemember'));
                break;
        }
    }
    return wp_authenticate_username_password($user, $username, $password);
}
开发者ID:Zurtr,项目名称:ultimatemember,代码行数:23,代码来源:um-filters-login.php

示例13: um_wp_form_errors_hook_logincheck

function um_wp_form_errors_hook_logincheck($user, $username, $password)
{
    remove_filter('authenticate', 'wp_authenticate_username_password', 20, 3);
    if (isset($user->ID)) {
        um_fetch_user($user->ID);
        $status = um_user('account_status');
        switch ($status) {
            case 'inactive':
                return new WP_Error($status, __('Ваш аккаунт был отключен.', 'ultimatemember'));
                break;
            case 'awaiting_admin_review':
                return new WP_Error($status, __('Ваш аккаунт не был одобрен еще.', 'ultimatemember'));
                break;
            case 'awaiting_email_confirmation':
                return new WP_Error($status, __('Ваша учетная запись ожидает проверки электронной почты.', 'ultimatemember'));
                break;
            case 'rejected':
                return new WP_Error($status, __('Ваш запрос на вступление была отклонена.', 'ultimatemember'));
                break;
        }
    }
    return wp_authenticate_username_password(null, $username, $password);
}
开发者ID:Ksajikyan,项目名称:poiskuslug,代码行数:23,代码来源:um-filters-login.php

示例14: check_custom_authentication

 function check_custom_authentication($user, $username, $password)
 {
     global $wpdb;
     $error = new WP_Error();
     if (is_a($user, 'WP_User')) {
         return $user;
     }
     // 		$rolename ='subscriber';
     // 		var_dump($rolename);
     // 		$role = get_role($rolename);
     // 		var_dump($role);exit();
     if (empty($username) || empty($password)) {
         //create new error object and add errors to it.
         if (empty($username)) {
             //No email
             $error->add('empty_username', __('<strong>ERROR</strong>: Email field is empty.'));
         }
         if (empty($password)) {
             //No password
             $error->add('empty_password', __('<strong>ERROR</strong>: Password field is empty.'));
         }
         return $error;
     }
     $role_allow = false;
     $user_obj = get_user_by('login', $username);
     if (is_object($user_obj)) {
         //$error->add('empty_username', __("<strong>ERROR</strong>: The user doesn't exist."));
         //return $error;
         $role = implode(', ', $user_obj->roles);
         if ($role != self::DOLIBARR_ROLE) {
             $role_allow = true;
         }
     }
     //var_dump($user_obj->ID);exit;
     //$resp = $this->createTransaction($user_obj->ID, 8);
     //var_dump($resp,'response');exit;
     // Si c'est pas le profile de lecteur de dolibarr
     // authentication normale de wp
     if ($role_allow) {
         return wp_authenticate_username_password($user, $username, $password);
     } else {
         // verifier dans dolibarr
         $rep = $this->dolibarr->dolibarr_check_authentication($username, $password);
         if (isset($rep["result"]["result_code"]) && $rep["result"]["result_code"] == 'OK') {
             if (username_exists($username)) {
                 $user = get_userdatabylogin($username);
                 return $user;
             } else {
                 $userdata = array('user_login' => $username, 'user_pass' => $password, 'user_email' => is_email($username) ? $username : null, 'role' => self::DOLIBARR_ROLE);
                 $user_id = wp_insert_user($userdata);
                 //On success
                 if (!is_wp_error($user_id)) {
                     #var_dump(is_plugin_active('memberpress/memberpress.php'));
                     if (is_plugin_active('memberpress/memberpress.php')) {
                         $resp = $this->createTransaction($user_id, 3048);
                         #var_dump($user_id, $resp);
                     }
                     //var_dump($resp,'response');exit;
                     $user = get_userdatabylogin($username);
                     #var_dump($user);
                     return $user;
                 } else {
                     $error = new WP_Error();
                     $error->add('registration_error', __('<strong>ERROR</strong>: There was an error registering your account. Please try again.'));
                     return $error;
                 }
             }
         } else {
             $error = new WP_Error();
             $error->add('incorrect_credentials', __('<strong>ERROR</strong>:' . $rep["result"]["result_label"]));
             return $error;
         }
     }
 }
开发者ID:aresvouk,项目名称:wp-doli,代码行数:74,代码来源:wp-doli.php

示例15: override_authentication

 function override_authentication($user, $username, $password)
 {
     // Mirror standard WP authentication
     if (is_a($user, 'WP_User')) {
         return $user;
     }
     if (!empty($username)) {
         // We have a login attempt so we are going to take over the authentication here
         // 1. Check the user exists
         if ($user = get_user_by('login', $username)) {
             // 2. We have a user so check if they have an expired password.
             if (!shrkey_has_usermeta_oncer($user->ID, '_shrkey_password_expired')) {
                 // No expired password setting for this user so fall through to original authentication
                 return;
             }
             // 3. We now need to authentication this user ourselves before we can continue
             $authenticated = wp_authenticate_username_password('', $username, $password);
             if (is_wp_error($authenticated)) {
                 // The credentials are not valid, so we'll return and fall through to the original function
                 return;
             }
             // We are still here so remove the original authentication method as we no longer need it
             remove_action('authenticate', 'wp_authenticate_username_password', 20, 3);
             // 4. Show the change password form as we want to force a password change at this point
             $this->show_reset_password_form($authenticated, wp_generate_password(35, false), isset($_POST['redirect_to']) ? $_POST['redirect_to'] : false);
             // Exit because we don't want to continue processing or pass anything along the chain at this point
             exit;
         } else {
             // Invalid username - return and fall through to the original authentication function handle it
             return;
         }
     }
     return;
 }
开发者ID:newball,项目名称:expirepassword,代码行数:34,代码来源:public.expirepassword.php


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