Пример #1
0
 /**
  * Execute the request of the admin user to change the password
  */
 public function dopasswordAction()
 {
     $code = $this->getRequest()->getParam('id');
     $user = AdminUser::checkMD5CredencialsByIspEmail($code);
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $form = new Admin_Form_PasswordForm(array('action' => '/admin/login/password', 'method' => 'post'));
     if (!empty($user)) {
         $isp = Isp::getActiveISP();
         // Get the template from the main email template folder
         $retval = Shineisp_Commons_Utilities::getEmailTemplate('isp_password_changed');
         $newpassword = AdminUser::resetPassword($user['user_id']);
         if (!empty($retval)) {
             $subject = $retval['subject'];
             $template = $retval['template'];
             $subject = str_replace("[lastname]", $user['lastname'], $subject);
             $template = str_replace("[lastname]", $user['lastname'], $template);
             $template = str_replace("[admin_url]", "http://" . $_SERVER['HTTP_HOST'] . "/admin/", $template);
             $template = str_replace("[email]", $user['email'], $template);
             $template = str_replace("[password]", $newpassword, $template);
             $template = str_replace("[signature]", $isp['company'], $template);
             Shineisp_Commons_Utilities::SendEmail($user['email'], $user['email'], null, $subject, $template);
             $this->view->message = $translator->translate('An email has been sent with the new login credentials');
         }
     }
     $this->view->passwordform = $form;
     return $this->render('password');
     // re-render the login form
 }