+ //Set user password
+ $user->setPassword($hashed);
+
+ //Persist user
+ $this->manager->persist($user);
+
+ //Send to database
+ $this->manager->flush();
+
+ //Add notice
+ $this->addFlash('notice', $this->translator->trans('Account password updated'));
+
+ //Redirect to user login
+ return $this->redirectToRoute($this->config['route']['login']['name'], ['mail' => $smail, 'hash' => $this->slugger->hash($smail)]+$this->config['route']['login']['context']);
+ //Find user by data mail
+ } elseif ($user = $this->doctrine->getRepository($this->config['class']['user'])->findOneByMail($data['mail'])) {
+ //Set context
+ $context = [
+ 'recipient_mail' => $user->getMail(),
+ 'recipient_name' => $user->getRecipientName()
+ ] + array_replace_recursive(
+ $this->config['context'],
+ $this->config['recover']['view']['context'],
+ $this->config['recover']['mail']['context']
+ );
+
+ //Generate each route route
+ foreach($this->config['recover']['route'] as $route => $tag) {
+ //Only process defined routes
+ if (!empty($this->config['route'][$route])) {
+ //Process for recover mail url
+ if ($route == 'recover') {
+ //Set the url in context
+ $context[$tag] = $this->router->generate(
+ $this->config['route'][$route]['name'],
+ //Prepend recover context with tag
+ [
+ 'mail' => $smail = $this->slugger->short($context['recipient_mail']),
+ 'pass' => $spass = $this->slugger->hash($pass = $user->getPassword()),
+ 'hash' => $this->slugger->hash($smail.$spass)
+ ]+$this->config['route'][$route]['context'],
+ UrlGeneratorInterface::ABSOLUTE_URL
+ );
+ }
+ }
+ }
+
+ //Iterate on keys to translate
+ foreach($this->config['translate'] as $translate) {
+ //Extract keys
+ $keys = explode('.', $translate);
+
+ //Set current
+ $current =& $context;
+
+ //Iterate on each subkey
+ do {
+ //Skip unset translation keys
+ if (!isset($current[current($keys)])) {
+ continue(2);
+ }
+
+ //Set current to subkey
+ $current =& $current[current($keys)];
+ } while(next($keys));