예제 #1
0
 public function passwordremindAction()
 {
     $this->_helper->layout()->setLayout("borrower/layout_login");
     $oModelUser = new Admin_Model_User();
     $oModelVUser = new Admin_Model_VUser();
     $oModelUserNewPassword = new Admin_Model_UserNewPassword();
     $oFormPasswordRemind = new Admin_Form_PasswordRemind();
     $oGenereteSessionId = new AppCms2_GenereteSessionId();
     $aPostData = array();
     $sSuccess = "";
     if ($this->_request->isPost()) {
         $aPostData = $this->_request->getPost();
         if ($oFormPasswordRemind->isValid($aPostData)) {
             $sEmailAddress = $oFormPasswordRemind->getValue("user_email_address");
             $nUserId = $oModelUser->findUserByEmailAddress($sEmailAddress);
             if (is_numeric($nUserId)) {
                 $aParam = $oModelVUser->getUserParam($nUserId)->toArray();
                 $aParam["salt"] = $oModelUser->getUserSalt($nUserId);
                 $aParam = array_merge($aParam, $oGenereteSessionId->generatePassword($aParam["salt"]));
                 if ($oModelUserNewPassword->addPassword($nUserId, $aParam)) {
                     $sEmailAddress = $oModelUser->findEmailAddress($nUserId);
                     $oMail = new AppCms2_Controller_Plugin_Mail();
                     $oMail->sendNewPassword($sEmailAddress, $aParam);
                     $sSuccess = "OK";
                 } else {
                     $sSuccess = "NO OK";
                 }
             } else {
                 $sSuccess = "USER";
             }
         }
     }
     $this->view->oFormPasswordRemind = $oFormPasswordRemind;
     $this->view->sSuccess = $sSuccess;
 }