/**
  * Function forgotpasswordAction which send mail for forgotted password on given user's email address.
  */
 public function forgotpasswordAction()
 {
     $this->view->ssMessage = implode($this->_helper->flashMessenger->getMessages(), '.');
     $oForgotPasswordForm = new Application_Form_ForgotPassword();
     $this->view->forgotPasswordForm = $oForgotPasswordForm;
     if ($this->getRequest()->isPost()) {
         $asUserFormDetail = $this->getRequest()->getPost();
         if ($oForgotPasswordForm->isValid($asUserFormDetail)) {
             $saFormDetails = $oForgotPasswordForm->getValues();
             $saUserDetail = Doctrine::getTable('Model_Users')->checkEmailExist($saFormDetails['email']);
             if ($saUserDetail) {
                 $updatePassword = strtoupper(substr(sha1(uniqid(rand(), true)), 0, 6));
                 Doctrine_Query::create()->update("Model_Users u")->set("u.password", "md5(?)", array($updatePassword))->where("u.email = ?", array($this->_getParam('email')))->execute();
                 $ssMailBody = $this->view->getHelper('partial')->partial('login/forgotPassword.phtml', array('firstname' => $saUserDetail[0]['first_name'], 'password' => $updatePassword));
                 $mailSubject = "Stream - forgot password notification";
                 Application_Model_General::zendRestMail($oForgotPasswordForm->getValue('email'), '*****@*****.**', $mailSubject, $ssMailBody);
                 $this->_helper->flashMessenger->addMessage('Your password is send successfully on your email address');
                 $this->_redirect('/login/forgotpassword');
             } else {
                 $this->view->ssMessage = 'Email is not matched!!! Please try again';
             }
         }
     }
 }