public function executeForgottenPassword(sfWebRequest $request) { // if the user is authenticated, they shouldn't get here PcUtils::redirectLoggedInUser($this->getUser(), $this); $this->form = new PasswordForgottenForm(); if ($request->isMethod('post')) { $this->form->bind($request->getParameter('passwordForgotten')); if ($this->form->isValid()) { $fields = $request->getParameter('passwordForgotten'); $email = $fields['email']; if (PcUserPeer::emailExist($email)) { CustomAuth::sendPasswordForgotten($email); $this->redirect('customAuth/passwordForgottenThankYou'); } else { $registrationLink = sfContext::getInstance()->getController()->genUrl('@registration'); $forgottenPasswordLink = sfContext::getInstance()->getController()->genUrl('@forgotten-password'); // the requested email doesn't exist! $this->getUser()->setFlash('password_forgotten_wrong', sprintf(__('WEBSITE_FORGOTTEN_PSW_EMAIL_ADDRESS_NOT_REGISTERED_ERROR'), $forgottenPasswordLink, $registrationLink)); } } } }