‪TYPO3CMS  ‪main
LoginErrorOccurredMessage.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use Psr\Http\Message\UriInterface;
24 
28 #[WebhookMessage(
29  identifier: 'typo3/login-error',
30  ‪description: 'LLL:EXT:webhooks/Resources/Private/Language/locallang_db.xlf:sys_webhook.webhook_type.typo3-login-error'
31 )]
32 final class LoginErrorOccurredMessage implements ‪WebhookMessageInterface
33 {
34  public function __construct(
35  private readonly bool $isFrontend,
36  private readonly UriInterface ‪$url,
37  private readonly array ‪$loginData,
38  ) {
39  }
40 
41  public function jsonSerialize(): array
42  {
43  return [
44  'context' => $this->isFrontend ? 'frontend' : 'backend',
45  'url' => (string)$this->url,
46  'loginData' => $this->loginData,
47  ];
48  }
49 
50  public static function createFromEvent(LoginAttemptFailedEvent $event): self
51  {
52  return new self(
53  $event->isFrontendAttempt(),
54  $event->getRequest()->getUri(),
55  $event->getLoginData()
56  );
57  }
58 }
‪TYPO3\CMS\Core\Authentication\Event\LoginAttemptFailedEvent
Definition: LoginAttemptFailedEvent.php:28
‪TYPO3\CMS\Core\Attribute\WebhookMessage
Definition: WebhookMessage.php:27
‪TYPO3\CMS\Webhooks\Message
Definition: FileAddedMessage.php:18
‪TYPO3\CMS\Core\Messaging\WebhookMessageInterface
Definition: WebhookMessageInterface.php:29
‪TYPO3\CMS\Webhooks\Message\$loginData
‪identifier readonly UriInterface readonly array $loginData
Definition: LoginErrorOccurredMessage.php:37
‪TYPO3\CMS\Webhooks\Message\description
‪identifier description
Definition: FileAddedMessage.php:36
‪TYPO3\CMS\Webhooks\Message\$url
‪identifier readonly UriInterface $url
Definition: LoginErrorOccurredMessage.php:36