From 7ff664e62b327d5c5530e4d2a0f54c3910e84778 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Thu, 16 Oct 2025 07:38:13 +0000 Subject: [PATCH] Fix: undefined $user --- app/init/resources.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/init/resources.php b/app/init/resources.php index eb18ec0326..4087d102ca 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -299,6 +299,8 @@ App::setResource('user', function (string $mode, Document $project, Document $co $store->decode(((is_array($fallback) && isset($fallback[$store->getKey()])) ? $fallback[$store->getKey()] : '')); } + $user = new Document([]); + if (APP_MODE_ADMIN === $mode) { $user = $dbForPlatform->getDocument('users', $store->getProperty('id', '')); } else { @@ -316,7 +318,6 @@ App::setResource('user', function (string $mode, Document $project, Document $co } if ( - !$user || $user->isEmpty() // Check a document has been found in the DB || !Auth::sessionVerify($user->getAttribute('sessions', []), $store->getProperty('secret', ''), $proofForToken) ) { // Validate user has valid login token