X-Git-Url: https://git.rapsys.eu/userbundle/blobdiff_plain/7dc270515bd6c60325a654486c088e8aab2094cf..0929c559670ac8d386a047789712e6164a640326:/Controller/DefaultController.php?ds=sidebyside diff --git a/Controller/DefaultController.php b/Controller/DefaultController.php index 7f6b02e..02e0d16 100644 --- a/Controller/DefaultController.php +++ b/Controller/DefaultController.php @@ -136,13 +136,11 @@ class DefaultController extends AbstractController { 'civility_default' => $doctrine->getRepository($this->config['class']['civility'])->findOneByTitle($this->config['default']['civility']), //Disable mail 'mail' => $this->isGranted('ROLE_ADMIN'), - //Disable slug - 'slug' => $this->isGranted('ROLE_ADMIN'), //Disable password 'password' => false, //Set method 'method' => 'POST' - ]); + ]+$this->config['edit']['field']); //With admin role if ($this->isGranted('ROLE_ADMIN')) { @@ -202,21 +200,6 @@ class DefaultController extends AbstractController { //Set data $data = $edit->getData(); - //Set slug - $slug = null; - - //With admin - if ($this->isGranted('ROLE_ADMIN')) { - //With slug - if (!empty($data->getSlug())) { - //Set slug - $slug = $slugger->slug($data->getPseudonym()); - } - - //Update slug - $data->setSlug($slug); - } - //Queue snippet save $manager->persist($data); @@ -738,10 +721,7 @@ class DefaultController extends AbstractController { $sfield = $field; //Reset field - $field = [ - //Without slug - 'slug' => false - ]; + $field = []; } //Init reflection @@ -762,7 +742,7 @@ class DefaultController extends AbstractController { 'mail' => true, //Set method 'method' => 'POST' - ]); + ]+$this->config['register']['field']); if ($request->isMethod('POST')) { //Refill the fields in case the form is not valid. @@ -790,18 +770,6 @@ class DefaultController extends AbstractController { //Set mail shortcut $registerMail =& $this->config['register']['mail']; - //Extract names and pseudonym from mail - $names = explode(' ', $pseudonym = ucwords(trim(preg_replace('/[^a-zA-Z]+/', ' ', current(explode('@', $data->getMail())))))); - - //Set pseudonym - $user->setPseudonym($user->getPseudonym()??$pseudonym); - - //Set forename - $user->setForename($user->getForename()??$names[0]); - - //Set surname - $user->setSurname($user->getSurname()??$names[1]??$names[0]); - //Set password $user->setPassword($encoder->encodePassword($user, $user->getPassword()??$data->getMail()));