renforcer par un uuid la génération auto d'un password

This commit is contained in:
Arnaud Fornerot 2022-09-15 14:54:34 +02:00
parent 87c9d362f2
commit af5c6f9626
2 changed files with 13 additions and 4 deletions

View File

@ -280,9 +280,12 @@ class SynchroCommand extends Command
$user->setUsername($ldapentry[$this->username]); $user->setUsername($ldapentry[$this->username]);
$user->setIsvisible(true); $user->setIsvisible(true);
$user->setApikey(Uuid::uuid4()); $user->setApikey(Uuid::uuid4());
$user->setPassword("LDAPPWD-".$ldapentry[$this->username]);
$user->setRole("ROLE_USER"); $user->setRole("ROLE_USER");
$user->setAvatar("noavatar.png"); $user->setAvatar("noavatar.png");
$uuid=Uuid::uuid4();
$user->setPassword("PWD-".$ldapentry[$this->username]."-".$uuid);
$this->em->persist($user); $this->em->persist($user);
} }
@ -736,9 +739,12 @@ class SynchroCommand extends Command
$user->setUsername($nineuser->userlogin); $user->setUsername($nineuser->userlogin);
$user->setIsvisible(true); $user->setIsvisible(true);
$user->setApikey(Uuid::uuid4()); $user->setApikey(Uuid::uuid4());
$user->setPassword("NINEPWD-".$nineuser->userlogin);
$user->setRole("ROLE_USER"); $user->setRole("ROLE_USER");
$user->setAvatar($nineuser->useravatar); $user->setAvatar($nineuser->useravatar);
$uuid=Uuid::uuid4();
$user->setPassword("PWD-".$nineuser->userlogin."-".$uuid);
$this->em->persist($user); $this->em->persist($user);
} }
@ -893,11 +899,13 @@ class SynchroCommand extends Command
$user->setEmail($email); $user->setEmail($email);
$user->setNiveau01($niveau01); $user->setNiveau01($niveau01);
$user->setSiren($niveau01->getSiren()); $user->setSiren($niveau01->getSiren());
$user->setPassword("PASSWORDFROMEXTERNE");
$user->setVisible(true); $user->setVisible(true);
$user->setAuthlevel("simple"); $user->setAuthlevel("simple");
$user->setBelongingpopulation("agent"); $user->setBelongingpopulation("agent");
$uuid=Uuid::uuid4();
$user->setPassword("PWD-".$username."-".$uuid);
if(in_array($username,$usersadmin)) if(in_array($username,$usersadmin))
$user->setRole("ROLE_ADMIN"); $user->setRole("ROLE_ADMIN");
else { else {

View File

@ -457,7 +457,8 @@ class SecurityController extends AbstractController
if(empty($avatar)) $avatar = "noavatar.png"; if(empty($avatar)) $avatar = "noavatar.png";
if(empty($firstname)) $firstname = " "; if(empty($firstname)) $firstname = " ";
if(empty($lastname)) $lastname = $username; if(empty($lastname)) $lastname = $username;
$password=$this->getParameter("appAuth")."PWD-".$username; $uuid=Uuid::uuid4();
$password=$this->getParameter("appAuth")."PWD-".$username."-".$uuid;
// Si aucun niveau01 on prend par défaut le niveau system // Si aucun niveau01 on prend par défaut le niveau system
if(!$niveau01) $niveau01=$em->getRepository('App\Entity\Niveau01')->find(-1); if(!$niveau01) $niveau01=$em->getRepository('App\Entity\Niveau01')->find(-1);