mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
feat: use timestamp instead of bool on is_verified
This commit is contained in:
@@ -47,7 +47,7 @@ readonly class EmailVerifier
|
||||
{
|
||||
$this->verifyEmailHelper->validateEmailConfirmationFromRequest($request, (string) $user->getId(), $user->getEmail());
|
||||
|
||||
$user->setVerified(true);
|
||||
$user->setVerifiedAt(new \DateTimeImmutable());
|
||||
|
||||
$this->entityManager->persist($user);
|
||||
$this->entityManager->flush();
|
||||
|
||||
@@ -33,7 +33,7 @@ class JWTAuthenticator implements AuthenticationSuccessHandlerInterface
|
||||
|
||||
public function handleAuthenticationSuccess(UserInterface $user, $jwt = null): Response
|
||||
{
|
||||
if (($user instanceof User) && !$user->isVerified()) {
|
||||
if (($user instanceof User) && null === $user->getVerifiedAt()) {
|
||||
throw new AccessDeniedHttpException('You have not yet validated your email address.');
|
||||
}
|
||||
|
||||
|
||||
@@ -57,8 +57,8 @@ class OAuthAuthenticator extends OAuth2Authenticator implements AuthenticationEn
|
||||
return $existingUser;
|
||||
}
|
||||
|
||||
$user = new User();
|
||||
$user->setEmail($userFromToken->getEmail())->setVerified(true);
|
||||
$user = (new User())->setCreatedAt(new \DateTimeImmutable());
|
||||
$user->setEmail($userFromToken->getEmail())->setVerifiedAt($user->getCreatedAt());
|
||||
$this->em->persist($user);
|
||||
$this->em->flush();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user