This commit is contained in:
afornerot 2024-11-26 21:37:44 +01:00
parent 4b7fd19685
commit c1aa1026a7
3 changed files with 11 additions and 8 deletions

View File

@ -1,6 +1,7 @@
{
"editor.fontSize": 14,
"php-cs-fixer.executablePath": "${workspaceFolder}/vendor/bin/php-cs-fixer",
"php-cs-fixer.onsave": true, // Active l'exécution à la sauvegarde
"php-cs-fixer.rules": null // Null pour utiliser les règles définies dans .php-cs-fixer.dist.php
"php-cs-fixer.onsave": true,
"php-cs-fixer.rules": "@Symfony",
"php-cs-fixer.config": ".php-cs-fixer.dist.php"
}

View File

@ -68,15 +68,17 @@ class UserController extends AbstractController
if (!$user) {
return $this->redirectToRoute('app_admin_user');
}
$oldpassword=$user->getPassword();
$hashedPassword = $user->getPassword();
$form = $this->createForm(UserType::class, $user, ['mode' => 'update']);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$user = $form->getData();
$hashedPassword = $passwordHasher->hashPassword(
$user,
$user->getPassword()
);
if (!$user->getPassword()) {
$hashedPassword = $passwordHasher->hashPassword(
$user,
$user->getPassword()
);
}
$user->setPassword($hashedPassword);
$em->persist($user);

View File

@ -110,7 +110,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
return $this->password;
}
public function setPassword(string $password): static
public function setPassword(?string $password): static
{
$this->password = $password;