wp_check_password
函数
wp_check_password ( $password, $hash, $user_id = '' )
- 参数
-
-
(string)
$password
Plaintext user’s password.- Required: 是
-
(string)
$hash
Hash of the user’s password to check against.- Required: 是
-
(string|int)
$user_id
Optional. User ID.- Required: 否
- Default: (empty)
-
(string)
- 返回值
-
- (bool) False, if the $password does not match the hashed password.
- 定义位置
-
-
wp-includes/pluggable.php
, line 2535
-
wp-includes/pluggable.php
- 引入
- 2.5.0
- 弃用
- –
Checks the plaintext password against the encrypted Password.
Maintains compatibility between old version and the new cookie authentication
protocol using PHPass library. The $hash parameter is the encrypted password
and the function compares the plain text password when encrypted similarly
against the already encrypted password to see if they match.
For integration with other applications, this function can be overwritten to
instead use the other package password checking algorithm.
function wp_check_password( $password, $hash, $user_id = '' ) { global $wp_hasher; // If the hash is still md5... if ( strlen( $hash ) CheckPassword( $password, $hash ); /** This filter is documented in wp-includes/pluggable.php */ return apply_filters( 'check_password', $check, $password, $hash, $user_id ); } endif; if ( ! function_exists( 'wp_generate_password' ) ) : /** * Generates a random password drawn from the defined set of characters. * * Uses wp_rand() is used to create passwords with far less predictability * than similar native PHP functions like `rand()` or `mt_rand()`. * * @since 2.5.0 * * @param int $length Optional. The length of password to generate. Default 12. * @param bool $special_chars Optional. Whether to include standard special characters. * Default true. * @param bool $extra_special_chars Optional. Whether to include other special characters. * Used when generating secret keys and salts. Default false. * @return string The random password. */
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。