From: Raphaƫl Gertz Date: Sat, 28 Aug 2021 10:38:10 +0000 (+0200) Subject: Switch to new getRecipientName user entity function X-Git-Tag: 0.2.0~20 X-Git-Url: https://git.rapsys.eu/userbundle/commitdiff_plain/022d0e9a32cc5b5f2475a98438b7651ab91c6ef2?hp=c3b641e801ce1526196b04e2722d3bb5c02a7ec6 Switch to new getRecipientName user entity function Cleanup --- diff --git a/Controller/DefaultController.php b/Controller/DefaultController.php index 02e0d16..c431b5d 100644 --- a/Controller/DefaultController.php +++ b/Controller/DefaultController.php @@ -391,7 +391,7 @@ class DefaultController extends AbstractController { $recoverMail['context']['recipient_mail'] = $user->getMail(); //Set recipient_name - $recoverMail['context']['recipient_name'] = trim($user->getForename().' '.$user->getSurname().($user->getPseudonym()?' ('.$user->getPseudonym().')':'')); + $recoverMail['context']['recipient_name'] = $user->getRecipientName(); //Init subject context $subjectContext = $slugger->flatten(array_replace_recursive($this->config['recover']['view']['context'], $recoverMail['context']), null, '.', '%', '%'); @@ -633,7 +633,7 @@ class DefaultController extends AbstractController { $activateMail['context']['recipient_mail'] = $existing->getMail(); //Set recipient name - $activateMail['context']['recipient_name'] = implode(' ', [$existing->getForename(), $existing->getSurname(), $existing->getPseudonym()?'('.$existing->getPseudonym().')':'']); + $activateMail['context']['recipient_name'] = $existing->getRecipientName(); //Init subject context $subjectContext = $slugger->flatten(array_replace_recursive($this->config['register']['view']['context'], $activateMail['context']), null, '.', '%', '%'); @@ -771,13 +771,7 @@ class DefaultController extends AbstractController { $registerMail =& $this->config['register']['mail']; //Set password - $user->setPassword($encoder->encodePassword($user, $user->getPassword()??$data->getMail())); - - //Set created - $user->setCreated(new \DateTime('now')); - - //Set updated - $user->setUpdated(new \DateTime('now')); + $user->setPassword($encoder->encodePassword($user, $user->getPassword())); //Persist user $manager->persist($user); @@ -817,17 +811,11 @@ class DefaultController extends AbstractController { } } - //XXX: DEBUG: remove me - //die($registerMail['context']['confirm_url']); - //Set recipient_name $registerMail['context']['recipient_mail'] = $data->getMail(); //Set recipient name - $registerMail['context']['recipient_name'] = ''; - - //Set recipient name - $registerMail['context']['recipient_name'] = implode(' ', [$data->getForename(), $data->getSurname(), $data->getPseudonym()?'('.$data->getPseudonym().')':'']); + $registerMail['context']['recipient_name'] = $data->getRecipientName(); //Init subject context $subjectContext = $slugger->flatten(array_replace_recursive($this->config['register']['view']['context'], $registerMail['context']), null, '.', '%', '%');