private function handleActivatePost() { $request = Request::getInstance(); $view = ViewManager::getInstance(); $systemUser = new SystemUser(); $loginRequest = new LoginRequest(); $view->setType(self::VIEW_ACTIVATE); try { if (!$request->exists('tag')) { throw new Exception('Tag ontbreekt.'); } if (!$request->exists('key')) { throw new Exception('Key is missing.'); } $key = $request->getValue('key'); if (!$key) { throw new Exception('Key is missing.'); } // get request details $requestKey = array('request_key' => $key); if (!$loginRequest->exists($requestKey)) { throw new Exception('Request does not exist.'); } $requestInfo = $loginRequest->getDetail($requestKey); // get user details $userKey = array('id' => $requestInfo['usr_id']); if (!$systemUser->exists($userKey)) { throw new Exception('Request does not exist.'); } $user = $systemUser->getDetail(array('id' => $requestInfo['usr_id'])); $tree = $this->director->tree; $tag = $request->getValue('tag'); $tree_id = $tree->getCurrentId(); $key = array('tree_id' => $tree_id, 'tag' => $tag); $settings = $this->getDetail($key); // hide old password and change with password validation $newpass1 = $request->getValue('newpass1'); $newpass2 = $request->getValue('newpass2'); if (!$newpass1 && !$newpass2) { throw new Exception("Password is missing."); } if ($newpass1 == $newpass2) { $systemUser->setPassword($userKey, $newpass1); } else { throw new Exception("Passwords do not match."); } // delete request //$loginRequest->delete($requestKey); $referer = $settings['fin_tree_id'] ? $tree->getPath($settings['fin_tree_id'], '/', Tree::TREE_ORIGINAL) : ($request->exists('referer') ? $request->getValue('referer') : '/'); header("Location: {$referer}"); exit; } catch (Exception $e) { $template = new TemplateEngine(); $template->setVariable('formError', $e->getMessage(), false); $this->handleHttpGetRequest(); } }