Exemplo n.º 1
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)));
     }
 }