]> Raphaƫl G. Git Repositories - userbundle/blobdiff - Controller/DefaultController.php
Add note about positional replaced argument
[userbundle] / Controller / DefaultController.php
index 02e0d163e97d05e0266127d3f3b7537e9f347fb8..070df0cb553e60519ba4f6bbe973bcc9f1720917 100644 (file)
@@ -183,11 +183,6 @@ class DefaultController extends AbstractController {
 
                        //Add reset view
                        $this->config['edit']['view']['context']['reset'] = $reset->createView();
 
                        //Add reset view
                        $this->config['edit']['view']['context']['reset'] = $reset->createView();
-               //Without admin role
-               //XXX: prefer a reset on login to force user unspam action
-               } else {
-                       //Add notice
-                       $this->addFlash('notice', $this->translator->trans('To change your password login with your mail and any password then follow the procedure'));
                }
 
                //With post method
                }
 
                //With post method
@@ -216,9 +211,14 @@ class DefaultController extends AbstractController {
                                //Catch double slug or mail
                                } catch (UniqueConstraintViolationException $e) {
                                        //Add error message mail already exists
                                //Catch double slug or mail
                                } catch (UniqueConstraintViolationException $e) {
                                        //Add error message mail already exists
-                                       $this->addFlash('error', $this->translator->trans('Account %mail% or with slug %slug% already exists', ['%mail%' => $data->getMail(), '%slug%' => $slug]));
+                                       $this->addFlash('error', $this->translator->trans('Account %mail% already exists', ['%mail%' => $data->getMail()]));
                                }
                        }
                                }
                        }
+               //Without admin role
+               //XXX: prefer a reset on login to force user unspam action
+               } elseif (!$this->isGranted('ROLE_ADMIN')) {
+                       //Add notice
+                       $this->addFlash('notice', $this->translator->trans('To change your password login with your mail and any password then follow the procedure'));
                }
 
                //Render view
                }
 
                //Render view
@@ -391,7 +391,7 @@ class DefaultController extends AbstractController {
                                                $recoverMail['context']['recipient_mail'] = $user->getMail();
 
                                                //Set recipient_name
                                                $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, '.', '%', '%');
 
                                                //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_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, '.', '%', '%');
 
                                                //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
                                $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);
 
                                //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
                                //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, '.', '%', '%');
 
                                //Init subject context
                                $subjectContext = $slugger->flatten(array_replace_recursive($this->config['register']['view']['context'], $registerMail['context']), null, '.', '%', '%');