Exemple #1
0
 function actionForgotPassword($params = '')
 {
     $errorMsg = '';
     $message = '';
     $objLayout = new LayoutModel();
     $objTemplate = new TemplatesModel();
     $layoutInfo = $objLayout->loadLayout();
     $template = $objTemplate->loadTemplateFromKeyname('user-forgotpassword');
     if (!empty($params['resetpassword']) && !empty($params['email'])) {
         $objUser = new UserModel();
         $userInfo = $objUser->forgotPassword($params['email']);
         if ($userInfo) {
             $objEmailer = new EmailSender();
             $objEmailer->sendUserForgotPassword($userInfo);
             $message = 'Your password has been reset, please check your email for the new password.';
         } else {
             $errorMsg = 'Unable to find a user with that email address.';
         }
     }
     $this->view->assign('errorMsg', $errorMsg);
     $this->view->assign('message', $message);
     $this->view->assign('content', $this->view->fetch('fromstring:' . $template['content']));
     $this->view->assign('sidebar_left', $this->view->fetch('fromstring:' . $template['left_sidebar']));
     $this->view->assign('sidebar_right', $this->view->fetch('fromstring:' . $template['right_sidebar']));
     $this->view->assign('layout', $this->view->fetch('fromstring:' . $layoutInfo['code']));
     $this->finish();
 }