예제 #1
0
 /**
  * Lost action : if user has lost his password
  * @access public
  * @return void
  */
 public function lost()
 {
     $this->form = new LostLoginForm();
     $req = new SRequestParams();
     if ($this->request->is_post()) {
         if ($this->form->is_valid($this->params['user'])) {
             try {
                 $user = User::$objects->get('email = ?', array($this->params['user']['email']));
                 $mailer = new ApplicationMailer();
                 $mailer->send_password_reminder($user);
                 $logger = new SLogger('../log/account.log');
                 $logger->info("{$user->login} ({$user->id}) password reminder sent to <{$user->email}>");
                 $this->flash['notice'] = __('Password reminder has been sent to you by email');
                 $this->redirect_to_login();
                 return;
             } catch (SRecordNotFound $e) {
                 $this->flash['error'] = __('This email address is not registered');
                 $this->form->errors = new SFormErrors(array('email' => __('Email not found')));
                 return;
             }
         }
         $this->flash['error'] = __('You have to give a valid registered email address.');
     }
 }