/** * Send 'remind password' email. * * @param Request $request * @return \Symfony\Component\HttpFoundation\RedirectResponse */ public function remindAction(Request $request) { if (!$request->getSession()->has('userId')) { $data = $request->request->all(); $user = new User(); $user->load($data['email'], 'email'); if ($user->getId()) { $message = \Swift_Message::newInstance()->setSubject('Forget Password')->setFrom('*****@*****.**')->setTo($user->getEmail())->setBody($this->renderView('LancerLanceBundle:Emails:forgetpassword.html.twig', array('name' => $user->getName(), 'hash' => $user->getSecretHash())), 'text/html'); $this->get('mailer')->send($message); $request->getSession()->set('message', 'Email with instruction has been send.'); } } return $this->redirectToRoute('lance_authorization'); }