‪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  public function jsonSerialize(): array
41  {
42  return [
43  'context' => $this->isFrontend ? 'frontend' : 'backend',
44  'url' => (string)$this->url,
45  'loginData' => $this->loginData,
46  ];
47  }
48 
49  public static function createFromEvent(LoginAttemptFailedEvent $event): self
50  {
51  return new self(
52  $event->isFrontendAttempt(),
53  $event->getRequest()->getUri(),
54  $event->getLoginData()
55  );
56  }
57 }
‪TYPO3\CMS\Core\Authentication\Event\LoginAttemptFailedEvent
Definition: LoginAttemptFailedEvent.php:27
‪TYPO3\CMS\Core\Attribute\WebhookMessage
Definition: WebhookMessage.php:25
‪TYPO3\CMS\Webhooks\Message
Definition: FileAddedMessage.php:18
‪TYPO3\CMS\Core\Messaging\WebhookMessageInterface
Definition: WebhookMessageInterface.php:28
‪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