v1.6.9
This commit is contained in:
parent
1ff471299e
commit
7379505d20
1 changed files with 912 additions and 139 deletions
|
|
@ -251,7 +251,7 @@ class Trusted_Devices {
|
|||
return false;
|
||||
}
|
||||
|
||||
if ( ! defined( 'AUTH_SALT' ) || '' === AUTH_SALT ) {
|
||||
if ( ! defined( 'AUTH_SALT' ) || ! is_string( AUTH_SALT ) || '' === AUTH_SALT ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -283,7 +283,7 @@ class Trusted_Devices {
|
|||
* @return void
|
||||
*/
|
||||
private function set_cookie( int $user_id, string $token, int $expires_at ): void {
|
||||
if ( ! defined( 'AUTH_SALT' ) || '' === AUTH_SALT ) {
|
||||
if ( ! defined( 'AUTH_SALT' ) || ! is_string( AUTH_SALT ) || '' === AUTH_SALT ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -295,7 +295,7 @@ class Trusted_Devices {
|
|||
$value,
|
||||
array(
|
||||
'expires' => $expires_at,
|
||||
'path' => defined( 'COOKIEPATH' ) ? COOKIEPATH : '/',
|
||||
'path' => defined( 'COOKIEPATH' ) && is_string( COOKIEPATH ) ? COOKIEPATH : '/',
|
||||
'domain' => defined( 'COOKIE_DOMAIN' ) ? COOKIE_DOMAIN : '',
|
||||
'secure' => is_ssl(),
|
||||
'httponly' => true,
|
||||
|
|
@ -315,7 +315,7 @@ class Trusted_Devices {
|
|||
'',
|
||||
array(
|
||||
'expires' => time() - YEAR_IN_SECONDS,
|
||||
'path' => defined( 'COOKIEPATH' ) ? COOKIEPATH : '/',
|
||||
'path' => defined( 'COOKIEPATH' ) && is_string( COOKIEPATH ) ? COOKIEPATH : '/',
|
||||
'domain' => defined( 'COOKIE_DOMAIN' ) ? COOKIE_DOMAIN : '',
|
||||
'secure' => is_ssl(),
|
||||
'httponly' => true,
|
||||
|
|
@ -364,12 +364,20 @@ class Trusted_Devices {
|
|||
/**
|
||||
* Retrieve the raw device map from user meta.
|
||||
*
|
||||
* Non-string keys (corrupted meta) are discarded so callers always
|
||||
* receive a token-hash-keyed map.
|
||||
*
|
||||
* @param int $user_id User ID.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function get_raw_devices( int $user_id ): array {
|
||||
$raw = get_user_meta( $user_id, self::META_KEY, true );
|
||||
return is_array( $raw ) ? $raw : array();
|
||||
|
||||
if ( ! is_array( $raw ) ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
return array_filter( $raw, 'is_string', ARRAY_FILTER_USE_KEY );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue