diff --git a/app/src/Controller/ErrorController.php b/app/src/Controller/ErrorController.php index 107ad62d2..34ee6b316 100644 --- a/app/src/Controller/ErrorController.php +++ b/app/src/Controller/ErrorController.php @@ -32,6 +32,10 @@ class ErrorController extends AppController */ public function initialize(): void { + // Tell cake to automatically negotiate JSON, which will have the + // most visible side effect of causing stack traces to render as + // JSON instead of HTML + $this->addViewClasses([\Cake\View\JsonView::class]); } /** diff --git a/app/src/Model/Table/ApiUsersTable.php b/app/src/Model/Table/ApiUsersTable.php index 34840f236..ddc3226d6 100644 --- a/app/src/Model/Table/ApiUsersTable.php +++ b/app/src/Model/Table/ApiUsersTable.php @@ -30,7 +30,7 @@ namespace App\Model\Table; use ArrayObject; -use Cake\Auth\FallbackPasswordHasher; +use Authentication\PasswordHasher\FallbackPasswordHasher; use Cake\Chronos\Chronos; use Cake\Event\EventInterface; use Cake\ORM\RulesChecker; @@ -225,8 +225,8 @@ public function validateKey(string $username, string $apiKey, string $remoteIp): $Hasher = new FallbackPasswordHasher([ 'hashers' => [ - 'Default' => [], - 'Weak' => ['hashType' => 'sha1'] + 'Authentication.Default' => [], + 'Authentication.Legacy' => ['hashType' => 'sha1'] ] ]);