]> Raphaël G. Git Repositories - userbundle/commitdiff
Fix reset password message display condition
authorRaphaël Gertz <git@rapsys.eu>
Sat, 28 Aug 2021 11:06:32 +0000 (13:06 +0200)
committerRaphaël Gertz <git@rapsys.eu>
Sat, 28 Aug 2021 11:06:32 +0000 (13:06 +0200)
Remove slug reference

Controller/DefaultController.php

index c431b5d8af1688ee6cf1230bd1b458477976d526..070df0cb553e60519ba4f6bbe973bcc9f1720917 100644 (file)
@@ -183,11 +183,6 @@ class DefaultController extends AbstractController {
 
                        //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
@@ -216,9 +211,14 @@ class DefaultController extends AbstractController {
                                //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