function resetpasswordAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $session = SessionWrapper::getInstance();
     $this->_translate = Zend_Registry::get("translate");
     $id = decode($this->_getParam('id'));
     // debugMessage($id);
     $user = new UserAccount();
     $user->populate($id);
     debugMessage($user->toArray());
     // $formvalues = array('email'=>$user->getEmail());
     $user->setEmail($user->getEmail());
     // debugMessage('error '.$user->getErrorStackAsString()); exit();
     if ($user->recoverPassword()) {
         $session->setVar(SUCCESS_MESSAGE, sprintf($this->_translate->translate('profile_change_password_admin_confirmation'), $user->getName()));
         // send a link to enable the user to recover their password
         // debugMessage('no error found ');
         $view = new Zend_View();
         $url = $this->view->serverUrl($this->view->baseUrl('profile/view/id/' . encode($user->getID())));
         $usecase = '1.9';
         $module = '1';
         $type = USER_RESET_PASSWORD;
         $details = "Reset password request. Reset link sent to <a href='" . $url . "' class='blockanchor'>" . $user->getName() . "</a>";
         $browser = new Browser();
         $audit_values = $session->getVar('browseraudit');
         $audit_values['module'] = $module;
         $audit_values['usecase'] = $usecase;
         $audit_values['transactiontype'] = $type;
         $audit_values['userid'] = $session->getVar('userid');
         $audit_values['url'] = $url;
         $audit_values['transactiondetails'] = $details;
         $audit_values['status'] = "Y";
         // debugMessage($audit_values);
         $this->notify(new sfEvent($this, $type, $audit_values));
     } else {
         $session->setVar(ERROR_MESSAGE, $user->getErrorStackAsString());
         $session->setVar(FORM_VALUES, $this->_getAllParams());
         // debugMessage('no error found ');
     }
     // exit();
     $this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_SUCCESS)));
 }
Exemplo n.º 2
0
 public function processresetpasswordAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $session = SessionWrapper::getInstance();
     $formvalues = $this->_getAllParams();
     // debugMessage($formvalues);
     $user = new UserAccount();
     $user->populate(decode($this->_getParam('id')));
     // debugMessage($user->toArray());
     $user->setUsername($formvalues['username']);
     $user->setStatus(1);
     $user->setAgreedToTerms(1);
     if (isEmptyString($user->getActivationDate())) {
         $startdate = date("Y-m-d H:i:s", time());
         $user->setActivationDate($startdate);
     }
     // exit();
     if ($user->resetPassword($this->_getParam('password'))) {
         // save to audit
         $url = $this->view->serverUrl($this->view->baseUrl('profile/view/id/' . encode($user->getID())));
         $usecase = '1.10';
         $module = '1';
         $type = USER_RESET_PASSWORD_CONFIRM;
         $details = "Reset password confirmed for <a href='" . $url . "' class='blockanchor'>" . $user->getName() . "</a>";
         $browser = new Browser();
         $audit_values = $session->getVar('browseraudit');
         $audit_values['module'] = $module;
         $audit_values['usecase'] = $usecase;
         $audit_values['transactiontype'] = $type;
         $audit_values['userid'] = $session->getVar('userid');
         $audit_values['url'] = $url;
         $audit_values['transactiondetails'] = $details;
         $audit_values['status'] = "Y";
         // debugMessage($audit_values);
         $this->notify(new sfEvent($this, $type, $audit_values));
         // send a link to enable the user to recover their password
         $session->setVar(SUCCESS_MESSAGE, "Sucessfully saved. You can now log in using your new Password");
         $this->_helper->redirector->gotoUrl($this->view->baseUrl("user/login"));
     } else {
         // echo "cannot reset password";
         // send an error message that no user with that email was found
         $session = SessionWrapper::getInstance();
         $session->setVar(ERROR_MESSAGE, $user->getErrorStackAsString());
         $session->setVar(FORM_VALUES, $this->_getAllParams());
         $this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_FAILURE)));
     }
 }
Exemplo n.º 3
0
 function activateaccountAction()
 {
     $session = SessionWrapper::getInstance();
     // replace the decoded id with an undecoded value which will be used during processPost()
     $id = decode($this->_getParam('id'));
     $this->_setParam('id', $id);
     $user = new UserAccount();
     $user->populate($id);
     $user->processPost($this->_getAllParams());
     if ($user->hasError()) {
         $session->setVar(FORM_VALUES, $this->_getAllParams());
         $session->setVar(ERROR_MESSAGE, $user->getErrorStackAsString());
         $this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_FAILURE)));
     }
     $result = $user->activateAccount($this->_getParam('activationkey'));
     if ($result) {
         // go to sucess page
         $this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_SUCCESS)));
     } else {
         $session->setVar(FORM_VALUES, $this->_getAllParams());
         $session->setVar(ERROR_MESSAGE, $user->getErrorStackAsString());
         $this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_FAILURE)));
     }
 }