From 430c883a889b6ac1a029c3ad418a4fcae25f8945 Mon Sep 17 00:00:00 2001 From: shimon Date: Mon, 20 Jan 2025 15:29:33 +0200 Subject: [PATCH] debug --- app/init.php | 14 +------------- src/Appwrite/Auth/Auth.php | 8 +++----- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/app/init.php b/app/init.php index 018140814c..ab4529406b 100644 --- a/app/init.php +++ b/app/init.php @@ -1301,14 +1301,7 @@ App::setResource('user', function ($mode, $project, $console, $request, $respons } else { $user = $dbForPlatform->getDocument('users', Auth::$unique); } - var_dump([ - 'number' => 1, - 'file' => 'init.php', - '$user' => $user, - 'Auth::$secret' => Auth::$secret, - 'sessions' => $user->getAttribute('sessions', []), - 'Auth::sessionVerify' => Auth::sessionVerify($user->getAttribute('sessions', []), Auth::$secret) - ]); + if ( $user->isEmpty() // Check a document has been found in the DB @@ -1318,11 +1311,6 @@ App::setResource('user', function ($mode, $project, $console, $request, $respons } - var_dump([ - 'number' => 2, - 'file' => 'init.php', - '$user' => $user, - ]); // if (APP_MODE_ADMIN === $mode) { // if ($user->find('teamInternalId', $project->getAttribute('teamInternalId'), 'memberships')) { // Authorization::setDefaultStatus(false); // Cancel security segmentation for admin users. diff --git a/src/Appwrite/Auth/Auth.php b/src/Appwrite/Auth/Auth.php index 72659dd6c5..4b1cb5f07a 100644 --- a/src/Appwrite/Auth/Auth.php +++ b/src/Appwrite/Auth/Auth.php @@ -391,12 +391,10 @@ class Auth foreach ($sessions as $session) { var_dump([ - 'secret' => $session->getAttribute('secret'), - 'provider' => $session->getAttribute('provider'), - 'expire' => $session->getAttribute('expire'), - 'hashed' => self::hash($secret), + 'secret from cookie' => $secret, + 'hashed secret' => self::hash($secret), + 'secret from db' => $session->getAttribute('secret'), 'secret_validation' => $session->getAttribute('secret') === self::hash($secret), - 'expiration_validation' => DateTime::formatTz(DateTime::format(new \DateTime($session->getAttribute('expire')))) >= DateTime::formatTz(DateTime::now()), ]);