public function preDispatch() { $this->getHelper('viewRenderer')->setNoController(true); $this->getHelper('viewRenderer')->setViewScriptPathNoControllerSpec('user/:action.:suffix'); if (!$this->_getParam('user') && $this->getRequest()->getActionName() != 'error') { $code = $this->_getParam('code'); if (!preg_match('#^(.*)-(\\w*)$#', $code, $m)) { $this->getRequest()->setParam('errorMessage', trlKwf("Activation code is invalid. Maybe the URL wasn't copied completely?")); $this->forward('error'); } else { $userId = $m[1]; $code = $m[2]; $userModel = Zend_Registry::get('userModel'); $user = $userModel->getRow($userId); $this->getRequest()->setParam('user', $user); if (!$user) { $this->getRequest()->setParam('errorMessage', trlKwf("Activation code is invalid. Maybe the URL wasn't copied completely?")); $this->forward('error'); } else { if (!$user->validateActivationToken($code) && $user->isActivated()) { $this->getRequest()->setParam('errorMessage', trlKwf("This account has already been activated.")); $this->forward('error'); } else { if (!$user->validateActivationToken($code)) { $this->getRequest()->setParam('errorMessage', trlKwf("Activation code is invalid. Maybe your account has already been activated, the URL was not copied completely, or the password has already been set?")); $this->forward('error'); } } } } } parent::preDispatch(); }
public function preDispatch() { $this->getHelper('viewRenderer')->setNoController(true); $this->getHelper('viewRenderer')->setViewScriptPathNoControllerSpec('user/:action.:suffix'); parent::preDispatch(); }