/** * returns initialized SiteUser object, check the "Is Allow Access" property. * This method MAY hijack flow controlby performing a recirect * or by rendering an alternate view * * @param Actions(enum) $action * @return SiteUser */ private function DoAuthenticate($action) { if (!Config::IsLoginRequired) { $user = new SiteUser(); $user->IsAllowAccess = true; return $user; } $login = new SimpleLogin(); if ($action == Actions::Logout) { $login->Logout(); header('Location: ' . self::MakeUri(Actions::Login)); return $login->GetUser(); } $user = $login->GetUser(); if (!$user->IsAllowAccess) { $builder = $this->GetBuilder(Actions::Login, $user); $model = $builder->Build($login); $user = $login->GetUser(); // during form post the builder automatically attempts a login -- let's check whether that succeeded... if (!$user->IsAllowAccess) { $this->RenderView($model, Actions::Login); return $user; } // successful login we redirect: header('Location: ' . self::MakeUri(Actions::Songbook)); return $user; } elseif ($action == Actions::Login) { // if for some reason visitor is already logged in but attempting to view the Login page, redirect: header('Location: ' . self::MakeUri(Actions::Songbook)); return $user; } // $user->IsAllowAccess = true; return $user; }
private function authorized() { // execute form only if not banned to prevent user check for fake post // requests, but check again after form processed to get right info. $auth = SimpleLogin::form(); if ($auth) { $this->layout->hide_action_links(); $this->layout->display_html($auth); return false; } return true; }
protected function login_form() { if (Base_AclCommon::i_am_user() && !Base_AclCommon::i_am_sa()) { Base_User_LoginCommon::logout(); } $form = SimpleLogin::form(); return "<p>$form</p>"; }
$fullscreen = !defined("_VALID_ACCESS"); !$fullscreen || define("_VALID_ACCESS", true); define('CID', false); require_once 'include/data_dir.php'; $config = file_exists(DATA_DIR . '/config.php'); if ($config) { include_once 'include.php'; ModuleManager::load_modules(); } if ($config && class_exists('Base_AclCommon')) { if (Base_AclCommon::i_am_user()) { if (!Base_AclCommon::i_am_sa()) { die('Only super admin can access this page'); } } else { $auth = SimpleLogin::form(); if ($auth) { print $auth; die; } } } if (class_exists('Base_LangCommon')) { Base_LangCommon::update_translations(); } if (class_exists('Base_ThemeCommon')) { Base_ThemeCommon::create_cache(); } if (class_exists('ModuleManager')) { ModuleManager::create_load_priority_array(); }