fix: always update encrypted password
This avoids issues with changed passwords or encryption keys
This commit is contained in:
+2
-3
@@ -18,7 +18,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
|||||||
private ?string $email;
|
private ?string $email;
|
||||||
|
|
||||||
#[ORM\Column(type: 'text')]
|
#[ORM\Column(type: 'text')]
|
||||||
private ?string $password;
|
private ?string $password = null;
|
||||||
|
|
||||||
#[ORM\Column(type: 'integer', nullable: true)]
|
#[ORM\Column(type: 'integer', nullable: true)]
|
||||||
private ?int $personId = null;
|
private ?int $personId = null;
|
||||||
@@ -32,10 +32,9 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
|||||||
#[ORM\Column(type: 'datetime_immutable', nullable: true)]
|
#[ORM\Column(type: 'datetime_immutable', nullable: true)]
|
||||||
private ?\DateTimeImmutable $lastLoginAt = null;
|
private ?\DateTimeImmutable $lastLoginAt = null;
|
||||||
|
|
||||||
public function __construct(string $email, string $password)
|
public function __construct(string $email)
|
||||||
{
|
{
|
||||||
$this->email = $email;
|
$this->email = $email;
|
||||||
$this->password = base64_encode($password);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
|
|||||||
@@ -87,11 +87,12 @@ class BpnAuthenticator extends AbstractLoginFormAuthenticator implements Authent
|
|||||||
$userRepository = $this->entityManager->getRepository(User::class);
|
$userRepository = $this->entityManager->getRepository(User::class);
|
||||||
|
|
||||||
if (null === $user = $userRepository->findOneBy(['email' => $email])) {
|
if (null === $user = $userRepository->findOneBy(['email' => $email])) {
|
||||||
$user = new User($email, $encryptedPassword);
|
$user = new User($email);
|
||||||
$this->entityManager->persist($user);
|
$this->entityManager->persist($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
$user
|
$user
|
||||||
|
->setPassword($encryptedPassword)
|
||||||
->setPersonId($personId)
|
->setPersonId($personId)
|
||||||
->setAddressId($addressId)
|
->setAddressId($addressId)
|
||||||
->setRoles($roles)
|
->setRoles($roles)
|
||||||
|
|||||||
Reference in New Issue
Block a user