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


PHP SwpmUtils::encrypt_password方法代码示例

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


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

示例1: wp_password_reset_hook

 function wp_password_reset_hook($user, $pass)
 {
     $swpm_id = SwpmUtils::get_user_by_user_name($user->user_login);
     if (!empty($swpm_id)) {
         $password_hash = SwpmUtils::encrypt_password($pass);
         global $wpdb;
         $wpdb->update($wpdb->prefix . "swpm_members_tbl", array('password' => $password_hash), array('member_id' => $swpm_id));
     }
 }
开发者ID:kevinotsuka,项目名称:coffeecircle,代码行数:9,代码来源:class.simple-wp-membership.php

示例2: reset_password

 public function reset_password($email)
 {
     $email = sanitize_email($email);
     if (!is_email($email)) {
         $message = '<div class="swpm-reset-pw-error">' . SwpmUtils::_("Email address not valid.") . '</div>';
         $message = array('succeeded' => false, 'message' => $message);
         SwpmTransfer::get_instance()->set('status', $message);
         return;
     }
     global $wpdb;
     $query = 'SELECT member_id,user_name,first_name, last_name FROM ' . $wpdb->prefix . 'swpm_members_tbl ' . ' WHERE email = %s';
     $user = $wpdb->get_row($wpdb->prepare($query, $email));
     if (empty($user)) {
         $message = '<div class="swpm-reset-pw-error">' . SwpmUtils::_("No user found with that email address.") . '</div>';
         $message .= '<div class="swpm-reset-pw-error-email">' . SwpmUtils::_("Email Address: ") . $email . '</div>';
         $message = array('succeeded' => false, 'message' => $message);
         SwpmTransfer::get_instance()->set('status', $message);
         return;
     }
     $settings = SwpmSettings::get_instance();
     $password = wp_generate_password();
     $password_hash = SwpmUtils::encrypt_password(trim($password));
     //should use $saned??;
     $wpdb->update($wpdb->prefix . "swpm_members_tbl", array('password' => $password_hash), array('member_id' => $user->member_id));
     //Update wp user password
     add_filter('send_password_change_email', array(&$this, 'dont_send_password_change_email'), 1, 3);
     //Stop wordpress from sending a reset password email to admin.
     SwpmUtils::update_wp_user($user->user_name, array('plain_password' => $password));
     $body = $settings->get_value('reset-mail-body');
     $subject = $settings->get_value('reset-mail-subject');
     $search = array('{user_name}', '{first_name}', '{last_name}', '{password}');
     $replace = array($user->user_name, $user->first_name, $user->last_name, $password);
     $body = html_entity_decode($body);
     $body = str_replace($search, $replace, $body);
     $from = $settings->get_value('email-from');
     $headers = "From: " . $from . "\r\n";
     wp_mail($email, $subject, $body, $headers);
     SwpmLog::log_simple_debug("Member password has been reset. Password reset email sent to: " . $email, true);
     $message = '<div class="swpm-reset-pw-success">' . SwpmUtils::_("New password has been sent to your email address.") . '</div>';
     $message .= '<div class="swpm-reset-pw-success-email">' . SwpmUtils::_("Email Address: ") . $email . '</div>';
     $message = array('succeeded' => false, 'message' => $message);
     SwpmTransfer::get_instance()->set('status', $message);
 }
开发者ID:andrewfieldwmg,项目名称:greenschoolsproject,代码行数:43,代码来源:class.swpm-front-registration.php

示例3: password

 protected function password()
 {
     $password = filter_input(INPUT_POST, 'password', FILTER_UNSAFE_RAW);
     $password_re = filter_input(INPUT_POST, 'password_re', FILTER_UNSAFE_RAW);
     if (empty($this->fields['password']) && empty($password)) {
         $this->errors['password'] = SwpmUtils::_('Password is required');
         return;
     }
     if (!empty($password)) {
         $saned = sanitize_text_field($password);
         $saned_re = sanitize_text_field($password_re);
         if ($saned != $saned_re) {
             $this->errors['password'] = SwpmUtils::_('Password mismatch');
         }
         $this->sanitized['plain_password'] = $password;
         $this->sanitized['password'] = SwpmUtils::encrypt_password(trim($password));
         //should use $saned??;
     }
 }
开发者ID:AndroidScriptAS,项目名称:bismarck_smv,代码行数:19,代码来源:class.swpm-form.php


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