diff --git a/app/controllers/general.php b/app/controllers/general.php index a1f9450a1b..0a046185d2 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -306,8 +306,9 @@ App::init() Authorization::setRole(Auth::USER_ROLE_APPS); Authorization::setDefaultStatus(false); // Cancel security segmentation for API keys. - if (time() > $key->getAttribute('accessedAt', 0) + APP_KEY_ACCCESS) { - $key->setAttribute('accessedAt', time()); + $accessedAt = $key->getAttribute('accessedAt', ''); + if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_KEY_ACCCESS)) > $accessedAt) { + $key->setAttribute('accessedAt', DateTime::now()); $dbForConsole->updateDocument('keys', $key->getId(), $key); $dbForConsole->deleteCachedDocument('projects', $project->getId()); } @@ -321,7 +322,7 @@ App::init() $key->setAttribute('sdks', $sdks); /** Update access time as well */ - $key->setAttribute('accessedAt', time()); + $key->setAttribute('accessedAt', Datetime::now()); $dbForConsole->updateDocument('keys', $key->getId(), $key); $dbForConsole->deleteCachedDocument('projects', $project->getId()); } diff --git a/composer.lock b/composer.lock index 831d28ec1c..8864cd1c62 100644 --- a/composer.lock +++ b/composer.lock @@ -5375,5 +5375,5 @@ "platform-overrides": { "php": "8.0" }, - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.3.0" }