Commit 82202ee9 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Correction du bug de création de nouvel utilisateur depuis la fiche intervenant

parent 34585aee
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -130,8 +130,9 @@ class Utilisateur extends AbstractUser implements UserInterface, AxiosExtractorI
            $bcrypt   = new \Laminas\Crypt\Password\Bcrypt();
            $password = $bcrypt->create($password);
        }

        parent::setPassword($password); // TODO: Change the autogenerated stub

        $this->setPasswordResetToken(null);
    }


+5 −4
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ use Application\Entity\Db\Utilisateur;
use Application\Service\Traits\IntervenantServiceAwareTrait;
use Application\Service\Traits\ParametresServiceAwareTrait;
use Application\Service\Traits\WorkflowServiceAwareTrait;
use Laminas\Crypt\Password\Bcrypt;
use UnicaenUtilisateur\Service\User\UserServiceAwareTrait;
use UnicaenApp\Util;

@@ -151,9 +152,8 @@ class UtilisateurService extends AbstractEntityService
            $this->getServiceIntervenant()->save($intervenant);
            $this->getServiceWorkflow()->calculerTableauxBord([], $intervenant);
        }
        $utilisateur->setPassword($motDePasse);
        $utilisateur->setPassword($motDePasse, true);
        $this->save($utilisateur);
        $this->changerMotDePasse($utilisateur, $motDePasse);

        return $utilisateur;
    }
@@ -163,10 +163,11 @@ class UtilisateurService extends AbstractEntityService
    public function changerMotDePasse(Utilisateur $utilisateur, string $motDePasse)
    {
        if (strlen($motDePasse) < 6) {
            throw new \Exception("Mot de passe trop court : il doit faire au moint 6 caractères");
            throw new \Exception("Mot de passe trop court : il doit faire au moins 6 caractères");
        }

        $this->userService->updateUserPassword($utilisateur, $motDePasse);
        $utilisateur->setPassword($motDePasse, true);
        $this->save($utilisateur);
    }

}
 No newline at end of file