|
7 | 7 | use CodeIgniter\HTTP\IncomingRequest;
|
8 | 8 | use CodeIgniter\HTTP\Response;
|
9 | 9 | use CodeIgniter\I18n\Time;
|
| 10 | +use CodeIgniter\Shield\Authentication\Actions\ActionInterface; |
10 | 11 | use CodeIgniter\Shield\Authentication\AuthenticationException;
|
11 | 12 | use CodeIgniter\Shield\Authentication\AuthenticatorInterface;
|
12 | 13 | use CodeIgniter\Shield\Authentication\Passwords;
|
@@ -287,7 +288,7 @@ private function checkUserState(): void
|
287 | 288 |
|
288 | 289 | $identities = $this->userIdentityModel->getIdentitiesByTypes(
|
289 | 290 | $this->user->getAuthId(),
|
290 |
| - ['email_2fa', 'email_activate'] |
| 291 | + $this->getActionTypes() |
291 | 292 | );
|
292 | 293 |
|
293 | 294 | // If we will have more than one identity, we need to change the logic blow.
|
@@ -325,6 +326,27 @@ private function checkUserState(): void
|
325 | 326 | $this->userState = self::STATE_ANONYMOUS;
|
326 | 327 | }
|
327 | 328 |
|
| 329 | + /** |
| 330 | + * @return string[] |
| 331 | + */ |
| 332 | + private function getActionTypes(): array |
| 333 | + { |
| 334 | + $actions = setting('Auth.actions'); |
| 335 | + $types = []; |
| 336 | + |
| 337 | + foreach ($actions as $actionClass) { |
| 338 | + if ($actionClass === null) { |
| 339 | + continue; |
| 340 | + } |
| 341 | + |
| 342 | + /** @var ActionInterface $action */ |
| 343 | + $action = Factories::actions($actionClass); // @phpstan-ignore-line |
| 344 | + $types[] = $action->getType(); |
| 345 | + } |
| 346 | + |
| 347 | + return $types; |
| 348 | + } |
| 349 | + |
328 | 350 | public function isPending(): bool
|
329 | 351 | {
|
330 | 352 | $this->checkUserState();
|
|
0 commit comments