merge_ResetPassword_to_Security #1

Merged
tracer merged 10 commits from merge_ResetPassword_to_Security into master 2022-11-01 16:19:33 +01:00
1 changed files with 63 additions and 0 deletions
Showing only changes of commit 3d4dec6299 - Show all commits

View File

@ -0,0 +1,63 @@
<?php
namespace App\Exception;
use JetBrains\PhpStorm\ArrayShape;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use function is_array;
class UserNotVerifiedException extends AuthenticationException
{
private ?string $identifier = null;
/**
* {@inheritdoc}
*/
public function getMessageKey(): string
{
return 'User is not verified.';
}
/**
* Get the user identifier (e.g. username or email address).
*/
public function getUserIdentifier(): ?string
{
return $this->identifier;
}
/**
* Set the user identifier (e.g. username or email address).
*/
public function setUserIdentifier(string $identifier): void
{
$this->identifier = $identifier;
}
/**
* {@inheritdoc}
*/
#[ArrayShape(shape: ['{{ username }}' => "null|string", '{{ user_identifier }}' => "null|string"])]
public function getMessageData(): array
{
return ['{{ username }}' => $this->identifier, '{{ user_identifier }}' => $this->identifier];
}
/**
* {@inheritdoc}
*/
public function __serialize(): array
{
return [$this->identifier, parent::__serialize()];
}
/**
* {@inheritdoc}
*/
public function __unserialize(array $data): void
{
[$this->identifier, $parentData] = $data;
$parentData = is_array(value: $parentData) ? $parentData : unserialize(data: $parentData);
parent::__unserialize(data: $parentData);
}
}