llms_verify_password_reset_key( string $key = '', string $login = '' )

Verifies a plain text password key for a user (by login) against the hashed key in the database


Description Description


Parameters Parameters

$key

(string) (Optional) plain text activation key

Default value: ''

$login

(string) (Optional) user login

Default value: ''


Top ↑

Return Return

(boolean)


Top ↑

Source Source

File: includes/llms.functions.core.php

function llms_verify_password_reset_key( $key = '', $login = '' ) {

	$key = preg_replace( '/[^a-z0-9]/i', '', $key );
	if ( empty( $key ) || ! is_string( $key ) ) {
		return false;
	}

	if ( empty( $login ) || ! is_string( $login ) ) {
		return false;
	}

	global $wpdb;
	$user_key = $wpdb->get_var( $wpdb->prepare(
		"SELECT user_activation_key FROM $wpdb->users WHERE user_login = %s",
		$login
	) );

	if ( empty( $user_key ) ) {
		return false;
	}

	global $wp_hasher;

	if ( empty( $wp_hasher ) ) {
		require_once ABSPATH . 'wp-includes/class-phpass.php';
		$wp_hasher = new PasswordHash( 8, true );
	}

	$valid = $wp_hasher->CheckPassword( $key, $user_key );

	if ( empty( $valid ) ) {
		return false;
	}

	return true;

}

Top ↑

Changelog Changelog

Changelog
Version Description
3.8.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.





Permalink: