示例#1
0
 function resetAction()
 {
     $this->_helper->layout->setLayout('layout-customer-credential');
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $id = $this->_request->getParam('id') ? $this->_request->getParam('id') : '';
     $obj = new Pandamp_Crypt_Password();
     $modelUser = new App_Model_Db_Table_User();
     $row = $modelUser->find($id)->current();
     $newpass = Pandamp_Lib_Formater::randompassowrd();
     $to = $row->email;
     $row->password = $obj->encryptPassword($newpass);
     $subject = "Your new password for Hukumonline.com";
     $message = "Dear {$row->fullName},\n\n";
     $message .= "As you requested, your password has now been reset. Your new details are as follows:\n\n";
     $message .= "Username: "******"\n";
     $message .= "Password: "******"\n\n";
     $message .= "All the best,\n";
     $message .= "Hukumonline.com";
     $config = new Zend_Config_Ini(ROOT_DIR . '/app/configs/mail.ini', 'mail');
     $options = array('auth' => $config->mail->auth, 'username' => $config->mail->username, 'password' => $config->mail->password);
     $transport = new Zend_Mail_Transport_Smtp($config->mail->host, $options);
     $mail = new Zend_Mail();
     $mail->setBodyText($message);
     $mail->setFrom($config->mail->sender->support->email, $config->mail->sender->support->name);
     $mail->addTo($to, $row->fullName);
     $mail->setSubject($subject);
     try {
         $mailTransport = Pandamp_Application::getResource('mail');
         $mail->send($mailTransport);
         $row->save();
     } catch (Zend_Exception $e) {
         echo $e->getMessage();
         die;
     }
 }