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


PHP utility::generate_password方法代码示例

本文整理汇总了PHP中utility::generate_password方法的典型用法代码示例。如果您正苦于以下问题:PHP utility::generate_password方法的具体用法?PHP utility::generate_password怎么用?PHP utility::generate_password使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在utility的用法示例。


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

示例1: wp_emember_generate_and_mail_password

function wp_emember_generate_and_mail_password($email)
{
    global $wpdb;
    if (empty($email) || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
        if (empty($email) || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
            return array('status_code' => false, 'msg' => EMEMBER_EMAIL_NOT_EXIST);
        }
    }
    $emember_config = Emember_Config::getInstance();
    $emailId = esc_sql(trim($email));
    $user = dbAccess::find(WP_EMEMBER_MEMBERS_TABLE_NAME, 'email=\'' . $emailId . '\'');
    if ($user) {
        require_once 'rand_pass.php';
        include_once ABSPATH . WPINC . '/class-phpass.php';
        $wp_hasher = new PasswordHash(8, TRUE);
        $reset_pass = utility::generate_password();
        //send mail from here with user name & password
        $wp_user_id = username_exists($user->user_name);
        if ($wp_user_id) {
            $wp_user_info = array();
            $wp_user_info['user_pass'] = $reset_pass;
            $wp_user_info['ID'] = $wp_user_id;
            wp_update_user($wp_user_info);
        }
        $fields = array();
        $password = $wp_hasher->HashPassword($reset_pass);
        $fields['password'] = esc_sql($password);
        dbAccess::update(WP_EMEMBER_MEMBERS_TABLE_NAME, 'member_id = ' . $user->member_id, $fields);
        $email_body = $emember_config->getValue('eMember_fogot_pass_email_body');
        $email_subject = $emember_config->getValue('eMember_fogot_pass_email_subject');
        $tags1 = array("{first_name}", "{last_name}", "{user_name}", "{password}");
        $vals1 = array($user->first_name, $user->last_name, $user->user_name, $reset_pass);
        $email_body = str_replace($tags1, $vals1, $email_body);
        $from_address = $emember_config->getValue('eMember_fogot_pass_senders_email_address');
        $headers = 'From: ' . $from_address . "\r\n";
        wp_mail($emailId, $email_subject, $email_body, $headers);
        eMember_log_debug("Member password reset email sent to : " . $emailId, true);
        //Update the affiliate profile password if applicable
        eMember_handle_affiliate_password_reset($emailId, $password);
        return array('status_code' => true, 'msg' => EMEMBER_PASS_EMAILED_MSG);
    } else {
        return array('status_code' => false, 'msg' => EMEMBER_EMAIL_NOT_EXIST);
    }
}
开发者ID:phupx,项目名称:genco,代码行数:44,代码来源:eMember_misc_functions.php


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