fix: always update encrypted password

This avoids issues with changed passwords or encryption keys
This commit is contained in:
Björn Fromme
2025-04-25 08:15:45 +02:00
parent b6ac9fb362
commit d9ab2a6e1f
2 changed files with 4 additions and 4 deletions
+2 -3
View File
@@ -18,7 +18,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
private ?string $email;
#[ORM\Column(type: 'text')]
private ?string $password;
private ?string $password = null;
#[ORM\Column(type: 'integer', nullable: true)]
private ?int $personId = null;
@@ -32,10 +32,9 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
#[ORM\Column(type: 'datetime_immutable', nullable: true)]
private ?\DateTimeImmutable $lastLoginAt = null;
public function __construct(string $email, string $password)
public function __construct(string $email)
{
$this->email = $email;
$this->password = base64_encode($password);
}
public function getId(): ?int
+2 -1
View File
@@ -87,11 +87,12 @@ class BpnAuthenticator extends AbstractLoginFormAuthenticator implements Authent
$userRepository = $this->entityManager->getRepository(User::class);
if (null === $user = $userRepository->findOneBy(['email' => $email])) {
$user = new User($email, $encryptedPassword);
$user = new User($email);
$this->entityManager->persist($user);
}
$user
->setPassword($encryptedPassword)
->setPersonId($personId)
->setAddressId($addressId)
->setRoles($roles)