public function Display($action = FrameworkController::SHOW_MESSAGE) { if ($action == FrameworkController::SHOW_MESSAGE) { $view = new MessageView(true); return $this->returnView($view); } else { if ($action == FrameworkController::CONTROLLER_NOT_FOUND) { return $this->returnFailure(ControllerBase::FAILURE_NOT_FOUND); } } return parent::Display(); }
public function Display() { if (count($this->params) > 0) { if ($this->params[0] == "log") { if (isset($this->request["message"]) && isset($this->request["loglevel"])) { if ($this->request["loglevel"] == 0) { LogHelper::getInstance()->logUserInfo($this->request["message"]); } else { if ($this->request["loglevel"] == 1) { LogHelper::getInstance()->logUserError($this->request["message"]); } else { LogHelper::getInstance()->logError($this->request["message"]); } } } return $this->returnView(new RawView(PartHelper::PART_MESSAGES)); } } return parent::Display(); }
public function Display() { if (count($this->params) == 0) { } else { if (count($this->params) > 0) { if ($this->params[0] == "setup") { if (ControllerHelper::getInstance()->isPostRequest($this->request, "setup")) { $exe = SetupWorkFlow::getInstance()->execute(); if (!$exe) { LogHelper::getInstance()->logUserError("setup failed!"); } } $view = new GenericCenterView("InstallationController", "setup", null, true); return $this->returnView($view); } else { if ($this->params[0] == "refreshCss") { if (ControllerHelper::getInstance()->isPostRequest($this->request, "setup")) { $exe = SetupWorkFlow::getInstance()->refreshCss(); if (!$exe) { LogHelper::getInstance()->logUserError("setup failed!"); } } $view = new GenericCenterView("InstallationController", "setup", null, true); return $this->returnView($view); } else { if ($this->params[0] == "refreshJs") { if (ControllerHelper::getInstance()->isPostRequest($this->request, "setup")) { $exe = SetupWorkFlow::getInstance()->refreshJs(); if (!$exe) { LogHelper::getInstance()->logUserError("setup failed!"); } } $view = new GenericCenterView("InstallationController", "setup", null, true); return $this->returnView($view); } } } } } return parent::Display(); }
public function Display() { $user = $this->authService->getUser(); if ($user !== false) { $this->exitWithControllerRedirect($this->loggedInRedirect); } if (count($this->params) == 0) { $view = new GenericCenterView("LoginController", "login", null, true); return $this->returnView($view); } else { if (count($this->params) > 0) { if ($this->params[0] == "login") { if (isset($this->request["login"]) && $this->request["login"] == "true") { //fill object ReflectionHelper::getInstance()->writeFromPostArrayToObjectProperties($this->instance, $this->request); $admin = GenericDatabaseService::getInstance()->getSingle($this->instance, array("Username" => $this->instance->getEmail()), true); if ($admin instanceof LoginDatabaseModel && PasswordHelper::getInstance()->validatePasswort($this->instance->getPassword(), $admin->getPasswordHash())) { AuthenticationService::getInstance()->setUser($admin); $this->exitWithRedirect($this->loggedInRedirect); } else { LogHelper::getInstance()->logUserError("login unsuccessful!"); $this->instance->setPassword(""); } } $view = new GenericCenterView("LoginController", "login", null, true); $view->assign("model", $this->instance); return $this->returnView($view); } else { if ($this->params[0] == "logout") { $this->authService->setUser(null); $this->exitWithControllerRedirect("/"); } else { return parent::Display(); } } } else { if (count($this->params) > 1) { if ($this->params[0] == "activateAccount" && PasswordHelper::getInstance()->checkIfHashIsValid($this->params[1])) { $admin = GenericDatabaseService::getInstance()->getSingle($this->instance, array("AuthHash" => $this->params[1]), true); if ($admin instanceof LoginDatabaseModel) { if (isset($this->request["activateAccount"]) && $this->request["activateAccount"] == true) { ReflectionHelper::getInstance()->writeFromPostArrayToObjectProperties($this->request, $admin); if ($this->canSetPassword($admin)) { $admin->setPasswordHash(PasswordHelper::getInstance()->convertToPasswordHash($admin->getPassword())); $admin->setAuthHash(""); GenericDatabaseService::getInstance()->update($admin, array("Id", "AuthHash", "PasswordHash")); } } $view = new GenericCenterView("LoginController", "addpass", null, true); return $this->returnView($view); } else { LogHelper::getInstance()->logUserInfo("link not valid anymore"); $view = new GenericCenterView("LoginController", "login", null, true); return $this->returnView($view); } } else { if ($this->params[0] == "forgotpass") { if (isset($this->request["forgotpass"]) && $this->request["forgotpass"] == "true") { $newHash = PasswordHelper::getInstance()->createUniqueHash(); $admin = GenericDatabaseService::getInstance()->getSingle($this->instance, array("Username" => $this->request["Username"])); if ($admin instanceof LoginDatabaseModel) { $admin->setAuthHash($newHash); GenericDatabaseService::getInstance()->update($admin, array("Id", "AuthHash")); return EmailService::getInstance()->sendEmailFromServer(LocaleService::getInstance()->translate("password reset"), LocaleService::getInstance()->translate("your password was reset. click following link to set a new one: " . RuntimeService::getInstance()->getRouteUrl() . "/activateAccount/" . $newHash), $admin->getAuthHash()); } LogHelper::getInstance()->logUserInfo("you will be contacted by us per email."); } $view = new GenericCenterView("LoginController", "forgotpass", null, true); return $this->returnView($view); } } } } } return parent::Display(); }