chg: usr: improve the gfx on homepage - implement login/register and activation for authentication - and add the first version of profile page #4
This commit is contained in:
83
src/Controller/ProfileController.php
Normal file
83
src/Controller/ProfileController.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php declare(strict_types=1);
|
||||
/*
|
||||
* This file is part of the SplendidBear Websites' projects.
|
||||
*
|
||||
* Copyright (c) 2026 @ www.splendidbear.org
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\User;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
/**
|
||||
* Class ProfileController
|
||||
*
|
||||
* @package App\Controller
|
||||
* @author Lang <https://www.splendidbear.org>
|
||||
* @category Class
|
||||
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html GNU Lesser General Public License
|
||||
* @link www.splendidbear.org
|
||||
* @since 2026. 04. 11.
|
||||
*/
|
||||
class ProfileController extends AbstractController
|
||||
{
|
||||
#[Route('/profile', name: 'MineSeekerBundle_profile')]
|
||||
public function index(EntityManagerInterface $em): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED');
|
||||
|
||||
/** @var User $user */
|
||||
$user = $this->getUser();
|
||||
|
||||
$finished = '(g.redPoints IS NOT NULL OR g.resign IS NOT NULL)';
|
||||
|
||||
$total = (int) $em->createQuery(
|
||||
"SELECT COUNT(g.id) FROM App\Entity\PlayedGame g
|
||||
WHERE (g.red = :u OR g.blue = :u) AND {$finished}"
|
||||
)->setParameter('u', $user)->getSingleScalarResult();
|
||||
|
||||
$wins = (int) $em->createQuery(
|
||||
"SELECT COUNT(g.id) FROM App\Entity\PlayedGame g WHERE (
|
||||
(g.red = :u AND g.redPoints > g.bluePoints AND g.resign IS NULL) OR
|
||||
(g.blue = :u AND g.bluePoints > g.redPoints AND g.resign IS NULL) OR
|
||||
(g.red = :u AND g.resign = 'blue') OR
|
||||
(g.blue = :u AND g.resign = 'red')
|
||||
)"
|
||||
)->setParameter('u', $user)->getSingleScalarResult();
|
||||
|
||||
$losses = (int) $em->createQuery(
|
||||
"SELECT COUNT(g.id) FROM App\Entity\PlayedGame g WHERE (
|
||||
(g.red = :u AND g.bluePoints > g.redPoints AND g.resign IS NULL) OR
|
||||
(g.blue = :u AND g.redPoints > g.bluePoints AND g.resign IS NULL) OR
|
||||
(g.red = :u AND g.resign = 'red') OR
|
||||
(g.blue = :u AND g.resign = 'blue')
|
||||
)"
|
||||
)->setParameter('u', $user)->getSingleScalarResult();
|
||||
|
||||
$bombs = (int) $em->createQuery(
|
||||
"SELECT COUNT(g.id) FROM App\Entity\PlayedGame g WHERE
|
||||
(g.red = :u AND g.redExplodedBomb = true) OR
|
||||
(g.blue = :u AND g.blueExplodedBomb = true)"
|
||||
)->setParameter('u', $user)->getSingleScalarResult();
|
||||
|
||||
$recent = $em->createQuery(
|
||||
"SELECT g FROM App\Entity\PlayedGame g
|
||||
LEFT JOIN g.red rr LEFT JOIN g.blue bb
|
||||
LEFT JOIN g.redAnon ra LEFT JOIN g.blueAnon ba
|
||||
WHERE (g.red = :u OR g.blue = :u) AND {$finished}
|
||||
ORDER BY g.updated DESC"
|
||||
)->setParameter('u', $user)->setMaxResults(10)->getResult();
|
||||
|
||||
return $this->render('Security/profile.html.twig', [
|
||||
'stats' => compact('total', 'wins', 'losses', 'bombs'),
|
||||
'recent' => $recent,
|
||||
]);
|
||||
}
|
||||
}
|
||||
155
src/Controller/SecurityController.php
Normal file
155
src/Controller/SecurityController.php
Normal file
@@ -0,0 +1,155 @@
|
||||
<?php declare(strict_types=1);
|
||||
/*
|
||||
* This file is part of the SplendidBear Websites' projects.
|
||||
*
|
||||
* Copyright (c) 2026 @ www.splendidbear.org
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\User;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Mailer\MailerInterface;
|
||||
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
|
||||
|
||||
/**
|
||||
* Class SecurityController
|
||||
*
|
||||
* @package App\Controller
|
||||
* @author Lang <https://www.splendidbear.org>
|
||||
* @category Class
|
||||
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html GNU Lesser General Public License
|
||||
* @link www.splendidbear.org
|
||||
* @since 2026. 04. 11.
|
||||
*/
|
||||
class SecurityController extends AbstractController
|
||||
{
|
||||
#[Route('/login', name: 'MineSeekerBundle_login')]
|
||||
public function login(AuthenticationUtils $authenticationUtils): Response
|
||||
{
|
||||
if ($this->getUser()) {
|
||||
return $this->redirectToRoute('MineSeekerBundle_homepage');
|
||||
}
|
||||
|
||||
return $this->render('Security/login.html.twig', [
|
||||
'last_username' => $authenticationUtils->getLastUsername(),
|
||||
'error' => $authenticationUtils->getLastAuthenticationError(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/logout', name: 'MineSeekerBundle_logout', methods: ['POST'])]
|
||||
public function logout(): void
|
||||
{
|
||||
// Intercepted by the security firewall — never executed.
|
||||
}
|
||||
|
||||
#[Route('/register', name: 'MineSeekerBundle_register')]
|
||||
public function register(
|
||||
Request $request,
|
||||
UserPasswordHasherInterface $hasher,
|
||||
EntityManagerInterface $em,
|
||||
MailerInterface $mailer,
|
||||
): Response {
|
||||
if ($this->getUser()) {
|
||||
return $this->redirectToRoute('MineSeekerBundle_homepage');
|
||||
}
|
||||
|
||||
$errors = [];
|
||||
|
||||
if ($request->isMethod('POST')) {
|
||||
$username = trim((string) $request->request->get('_username', ''));
|
||||
$email = trim((string) $request->request->get('_email', ''));
|
||||
$password = (string) $request->request->get('_password', '');
|
||||
$passwordConfirm = (string) $request->request->get('_password_confirm', '');
|
||||
|
||||
if (mb_strlen($username) < 3) {
|
||||
$errors['username'] = 'Username must be at least 3 characters.';
|
||||
} elseif ($em->getRepository(User::class)->findOneBy(['username' => $username])) {
|
||||
$errors['username'] = 'This username is already taken.';
|
||||
}
|
||||
|
||||
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||
$errors['email'] = 'Please enter a valid email address.';
|
||||
} elseif ($em->getRepository(User::class)->findOneBy(['email' => $email])) {
|
||||
$errors['email'] = 'This email address is already registered.';
|
||||
}
|
||||
|
||||
if (mb_strlen($password) < 6) {
|
||||
$errors['password'] = 'Password must be at least 6 characters.';
|
||||
} elseif ($password !== $passwordConfirm) {
|
||||
$errors['password_confirm'] = 'Passwords do not match.';
|
||||
}
|
||||
|
||||
if (empty($errors)) {
|
||||
$token = bin2hex(random_bytes(32));
|
||||
|
||||
$user = (new User())
|
||||
->setUsername($username)
|
||||
->setEmail($email)
|
||||
->setIsVerified(false)
|
||||
->setVerificationToken($token);
|
||||
|
||||
$user->setPassword($hasher->hashPassword($user, $password));
|
||||
|
||||
$em->persist($user);
|
||||
$em->flush();
|
||||
|
||||
$activationUrl = $this->generateUrl(
|
||||
'MineSeekerBundle_activate',
|
||||
['token' => $token],
|
||||
UrlGeneratorInterface::ABSOLUTE_URL,
|
||||
);
|
||||
|
||||
$mailer->send(
|
||||
(new TemplatedEmail())
|
||||
->from('noreply@mineseeker.ninja')
|
||||
->to($email)
|
||||
->subject('Activate your MineSeeker account')
|
||||
->htmlTemplate('emails/activation.html.twig')
|
||||
->context([
|
||||
'username' => $username,
|
||||
'activation_url' => $activationUrl,
|
||||
])
|
||||
);
|
||||
|
||||
$this->addFlash('verify_email', $email);
|
||||
|
||||
return $this->redirectToRoute('MineSeekerBundle_register');
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('Security/register.html.twig', [
|
||||
'errors' => $errors,
|
||||
'last_username' => $request->request->get('_username', ''),
|
||||
'last_email' => $request->request->get('_email', ''),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/activate/{token}', name: 'MineSeekerBundle_activate')]
|
||||
public function activate(string $token, EntityManagerInterface $em): Response
|
||||
{
|
||||
$user = $em->getRepository(User::class)->findOneBy(['verificationToken' => $token]);
|
||||
|
||||
if (!$user) {
|
||||
$this->addFlash('error', 'This activation link is invalid or has already been used.');
|
||||
return $this->redirectToRoute('MineSeekerBundle_login');
|
||||
}
|
||||
|
||||
$user->setIsVerified(true)->setVerificationToken(null);
|
||||
$em->flush();
|
||||
|
||||
$this->addFlash('success', 'Your account is now active. Welcome, ' . $user->getUsername() . '!');
|
||||
|
||||
return $this->redirectToRoute('MineSeekerBundle_login');
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,10 @@ use Doctrine\ORM\Mapping\Column;
|
||||
use Doctrine\ORM\Mapping\Entity;
|
||||
use Doctrine\ORM\Mapping\GeneratedValue;
|
||||
use Doctrine\ORM\Mapping\Id;
|
||||
use Doctrine\ORM\Mapping\Table;
|
||||
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* Class User
|
||||
@@ -28,6 +30,7 @@ use Symfony\Component\Security\Core\User\UserInterface;
|
||||
* @link www.splendidbear.org
|
||||
* @since 2026. 04. 09.
|
||||
*/
|
||||
#[Table(name: 'app_user')]
|
||||
#[Entity(repositoryClass: UserRepository::class)]
|
||||
class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
{
|
||||
@@ -43,6 +46,15 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
#[Column(nullable: true)]
|
||||
private ?string $password = null;
|
||||
|
||||
#[Column(length: 254, unique: true, nullable: true)]
|
||||
private ?string $email = null;
|
||||
|
||||
#[Column]
|
||||
private bool $isVerified = false;
|
||||
|
||||
#[Column(length: 64, nullable: true)]
|
||||
private ?string $verificationToken = null;
|
||||
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
@@ -92,4 +104,37 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
public function eraseCredentials(): void
|
||||
{
|
||||
}
|
||||
|
||||
public function getEmail(): ?string
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
public function setEmail(?string $email): self
|
||||
{
|
||||
$this->email = $email;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isVerified(): bool
|
||||
{
|
||||
return $this->isVerified;
|
||||
}
|
||||
|
||||
public function setIsVerified(bool $isVerified): self
|
||||
{
|
||||
$this->isVerified = $isVerified;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getVerificationToken(): ?string
|
||||
{
|
||||
return $this->verificationToken;
|
||||
}
|
||||
|
||||
public function setVerificationToken(?string $verificationToken): self
|
||||
{
|
||||
$this->verificationToken = $verificationToken;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
87
src/Migrations/2026/04/Version20260411180138.php
Normal file
87
src/Migrations/2026/04/Version20260411180138.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of the SplendidBear Websites' projects.
|
||||
*
|
||||
* Copyright (c) 2026 @ www.splendidbear.org
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Class Version20260411180138
|
||||
*
|
||||
* @package App\Migrations
|
||||
* @author Lang <https://www.splendidbear.org>
|
||||
* @category Class
|
||||
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html GNU Lesser General Public License
|
||||
* @link www.splendidbear.org
|
||||
* @since 2026. 04. 11.
|
||||
*/
|
||||
final class Version20260411180138 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Initialize the Mineseeker';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('CREATE SEQUENCE app_user_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE gamer_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE grid_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE grid_row_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE played_game_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE step_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE TABLE app_user (id INT NOT NULL, username VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) DEFAULT NULL, email VARCHAR(254) DEFAULT NULL, is_verified BOOLEAN NOT NULL, verification_token VARCHAR(64) DEFAULT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_88BDF3E9F85E0677 ON app_user (username)');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_88BDF3E9E7927C74 ON app_user (email)');
|
||||
$this->addSql('CREATE TABLE gamer (id INT NOT NULL, user_name VARCHAR(100) NOT NULL, ip VARCHAR(20) DEFAULT NULL, country VARCHAR(100) DEFAULT NULL, user_agent VARCHAR(255) DEFAULT NULL, conn_timestamp TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE TABLE grid (id INT NOT NULL, played_game_id INT DEFAULT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_2E20D9375AA11DBB ON grid (played_game_id)');
|
||||
$this->addSql('CREATE TABLE grid_row (id INT NOT NULL, grid INT DEFAULT NULL, grid_col JSON NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE INDEX IDX_6FAD08EB2E20D937 ON grid_row (grid)');
|
||||
$this->addSql('CREATE TABLE played_game (id INT NOT NULL, red_id INT DEFAULT NULL, red_anon INT DEFAULT NULL, blue_id INT DEFAULT NULL, blue_anon INT DEFAULT NULL, game_assoc VARCHAR(50) NOT NULL, red_points INT DEFAULT NULL, blue_points INT DEFAULT NULL, red_exploded_bomb BOOLEAN DEFAULT NULL, blue_exploded_bomb BOOLEAN DEFAULT NULL, resign VARCHAR(7) DEFAULT NULL, created TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updated TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE INDEX IDX_54BE80398BBE8922 ON played_game (red_id)');
|
||||
$this->addSql('CREATE INDEX IDX_54BE8039F24372EB ON played_game (red_anon)');
|
||||
$this->addSql('CREATE INDEX IDX_54BE80395AB9393F ON played_game (blue_id)');
|
||||
$this->addSql('CREATE INDEX IDX_54BE8039C64E7C7C ON played_game (blue_anon)');
|
||||
$this->addSql('CREATE TABLE step (id INT NOT NULL, played_game_id INT DEFAULT NULL, row INT NOT NULL, col INT NOT NULL, w_bomb BOOLEAN DEFAULT NULL, player VARCHAR(10) DEFAULT NULL, revealed_cells JSON DEFAULT NULL, created TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE INDEX IDX_43B9FE3C5AA11DBB ON step (played_game_id)');
|
||||
$this->addSql('ALTER TABLE grid ADD CONSTRAINT FK_2E20D9375AA11DBB FOREIGN KEY (played_game_id) REFERENCES played_game (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE grid_row ADD CONSTRAINT FK_6FAD08EB2E20D937 FOREIGN KEY (grid) REFERENCES grid (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE played_game ADD CONSTRAINT FK_54BE80398BBE8922 FOREIGN KEY (red_id) REFERENCES app_user (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE played_game ADD CONSTRAINT FK_54BE8039F24372EB FOREIGN KEY (red_anon) REFERENCES gamer (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE played_game ADD CONSTRAINT FK_54BE80395AB9393F FOREIGN KEY (blue_id) REFERENCES app_user (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE played_game ADD CONSTRAINT FK_54BE8039C64E7C7C FOREIGN KEY (blue_anon) REFERENCES gamer (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE step ADD CONSTRAINT FK_43B9FE3C5AA11DBB FOREIGN KEY (played_game_id) REFERENCES played_game (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP SEQUENCE app_user_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE gamer_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE grid_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE grid_row_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE played_game_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE step_id_seq CASCADE');
|
||||
$this->addSql('ALTER TABLE grid DROP CONSTRAINT FK_2E20D9375AA11DBB');
|
||||
$this->addSql('ALTER TABLE grid_row DROP CONSTRAINT FK_6FAD08EB2E20D937');
|
||||
$this->addSql('ALTER TABLE played_game DROP CONSTRAINT FK_54BE80398BBE8922');
|
||||
$this->addSql('ALTER TABLE played_game DROP CONSTRAINT FK_54BE8039F24372EB');
|
||||
$this->addSql('ALTER TABLE played_game DROP CONSTRAINT FK_54BE80395AB9393F');
|
||||
$this->addSql('ALTER TABLE played_game DROP CONSTRAINT FK_54BE8039C64E7C7C');
|
||||
$this->addSql('ALTER TABLE step DROP CONSTRAINT FK_43B9FE3C5AA11DBB');
|
||||
$this->addSql('DROP TABLE app_user');
|
||||
$this->addSql('DROP TABLE gamer');
|
||||
$this->addSql('DROP TABLE grid');
|
||||
$this->addSql('DROP TABLE grid_row');
|
||||
$this->addSql('DROP TABLE played_game');
|
||||
$this->addSql('DROP TABLE step');
|
||||
}
|
||||
}
|
||||
44
src/Security/UserChecker.php
Normal file
44
src/Security/UserChecker.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php declare(strict_types=1);
|
||||
/*
|
||||
* This file is part of the SplendidBear Websites' projects.
|
||||
*
|
||||
* Copyright (c) 2026 @ www.splendidbear.org
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\Security;
|
||||
|
||||
use App\Entity\User;
|
||||
use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException;
|
||||
use Symfony\Component\Security\Core\User\UserCheckerInterface;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
/**
|
||||
* Class UserChecker
|
||||
*
|
||||
* @package App\Security
|
||||
* @author Lang <https://www.splendidbear.org>
|
||||
* @category Class
|
||||
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html GNU Lesser General Public License
|
||||
* @link www.splendidbear.org
|
||||
* @since 2026. 04. 11.
|
||||
*/
|
||||
final class UserChecker implements UserCheckerInterface
|
||||
{
|
||||
public function checkPreAuth(UserInterface $user): void
|
||||
{
|
||||
if (!$user instanceof User) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$user->isVerified()) {
|
||||
throw new CustomUserMessageAuthenticationException(
|
||||
'Please verify your email address before signing in. Check your inbox for the activation link.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function checkPostAuth(UserInterface $user): void { }
|
||||
}
|
||||
Reference in New Issue
Block a user