Skip to content

Commit 9de7bd6

Browse files
committed
WIP fixing stan
1 parent 3f8f398 commit 9de7bd6

14 files changed

+33
-28
lines changed

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@
3636
},
3737
"require-dev": {
3838
"cakephp/cakephp-codesniffer": "^4.5",
39+
"google/recaptcha": "@stable",
3940
"league/flysystem-vfs": "^1.0",
4041
"laminas/laminas-diactoros": "^3.0",
4142
"phpunit/phpunit": "^10.0",
4243
"phpstan/phpstan": "^1.8",
4344
"robthree/twofactorauth": "^1.6",
44-
"vlucas/phpdotenv": "^3.3"
45+
"vlucas/phpdotenv": "^3.3",
46+
"web-auth/webauthn-lib": "^5.0"
4547
},
4648
"autoload": {
4749
"psr-4": {

phpstan-baseline.neon

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ parameters:
1717
count: 1
1818
path: src\Service\Action\Auth\ResetPasswordAction.php
1919

20-
-
21-
message: "#^Call to an undefined method Cake\\\\ORM\\\\Table\\:\\:validationPasswordConfirm\\(\\)\\.$#"
22-
count: 1
23-
path: src\Service\Action\Auth\ResetPasswordAction.php
24-
2520
-
2621
message: "#^Call to an undefined method Cake\\\\ORM\\\\Table\\:\\:changePassword\\(\\)\\.$#"
2722
count: 1
@@ -46,5 +41,3 @@ parameters:
4641
message: "#^Call to an undefined method Cake\\\\ORM\\\\Table\\:\\:resetToken\\(\\)\\.$#"
4742
count: 1
4843
path: src\Service\Action\Auth\ValidateAccountRequestAction.php
49-
50-

src/Model/Entity/AuthStore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class AuthStore extends Entity
2424
*
2525
* @var array<string, bool>
2626
*/
27-
protected $_accessible = [
27+
protected array $_accessible = [
2828
'id' => true,
2929
'store' => true,
3030
'created' => true,

src/Rbac/Rules/TwoFactorPassedScope.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
*/
2323
class TwoFactorPassedScope extends AbstractRule
2424
{
25-
protected $_defaultConfig = [
25+
protected array $_defaultConfig = [
2626
];
2727

2828
/**
2929
* @inheritDoc
3030
*/
31-
public function allowed($user, $role, ServerRequestInterface $request)
31+
public function allowed(array|\ArrayAccess $user, string $role, ServerRequestInterface $request): bool
3232
{
3333
$authentication = $request->getAttribute('authentication');
3434
if ($authentication === null) {

src/Rbac/Rules/TwoFactorScope.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
*/
2323
class TwoFactorScope extends AbstractRule
2424
{
25-
protected $_defaultConfig = [
25+
protected array $_defaultConfig = [
2626
];
2727

2828
/**
2929
* @inheritDoc
3030
*/
31-
public function allowed($user, $role, ServerRequestInterface $request)
31+
public function allowed(array|\ArrayAccess $user, string $role, ServerRequestInterface $request): bool
3232
{
3333
$authentication = $request->getAttribute('authentication');
3434
if ($authentication === null) {

src/Service/Action/Auth/OtpVerifyCheckAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function execute()
4848
unset($user['secret']);
4949

5050
if (!$user['secret_verified']) {
51-
$this->getUsersTable()->query()->update()
51+
$this->getUsersTable()->updateQuery()
5252
->set(['secret_verified' => true])
5353
->where(['id' => $user['id']])
5454
->execute();

src/Service/Action/Auth/OtpVerifyGetAction.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ protected function onVerifyGetSecret($user)
6767

6868
$secret = $this->createSecret();
6969
try {
70-
$query = $this->getUsersTable()->query();
71-
$query->update()
70+
$query = $this->getUsersTable()->updateQuery();
71+
$query
7272
->set(['secret' => $secret])
7373
->where(['id' => $user['id']]);
7474
$query->execute();

src/Service/Action/Auth/ResetPasswordAction.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ public function execute()
118118
*/
119119
protected function _changePassword($userId)
120120
{
121+
/** @var \CakeDC\Users\Model\Entity\User $user */
121122
$user = $this->getUsersTable()->newEntity([], ['validate' => false]);
122123
$user->id = $userId;
123124
try {

src/Service/Action/Auth/Webauthn2faAuthAction.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace CakeDC\Api\Service\Action\Auth;
1515

16+
use Cake\Log\Log;
1617
use CakeDC\Api\Service\Action\Action;
1718
use CakeDC\Api\Webauthn\AuthenticateAdapter;
1819
use CakeDC\Users\Controller\Traits\CustomUsersTableTrait;
@@ -31,6 +32,7 @@ class Webauthn2faAuthAction extends Action
3132
* Execute action.
3233
*
3334
* @return mixed
35+
* @throws \Throwable
3436
*/
3537
public function execute()
3638
{

src/Service/Action/Auth/Webauthn2faRegisterAction.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace CakeDC\Api\Service\Action\Auth;
1515

16+
use Cake\Http\Exception\BadRequestException;
1617
use CakeDC\Api\Service\Action\Action;
1718
use CakeDC\Api\Webauthn\RegisterAdapter;
1819
use CakeDC\Users\Controller\Traits\CustomUsersTableTrait;

0 commit comments

Comments
 (0)