public function test_encrypted_login() { $this->model->update_attributes($this->get_fixture("encrypteduser")); $auth = new WaxAuthDb(array("encrypt" => true, "db_table" => "test_auth_user")); $auth->verify("encrypted", "password"); $this->assertTrue($auth->is_logged_in()); }
function __construct() { /** * authentication **/ $auth = new WaxAuthDb(array("encrypt" => false, "db_table" => $this->auth_database_table, "session_key" => "wildfire_user_cookie")); $this->current_user = $auth->get_user(); if ($this->current_user->usergroup == 30) { $this->is_admin = true; } /** * module setup **/ $this->before_filter("all", "check_authorised", array("login")); $this->configure_modules(); $this->all_modules = CMSApplication::get_modules(true); if (!array_key_exists($this->module_name, CMSApplication::get_modules())) { Session::add_message('This component is not registered with the application.'); $this->redirect_to('/admin/home/index'); } /** * model instanciation **/ $this->cm_conf = CmsConfiguration::get("general"); if ($this->model_class) { $this->model = new $this->model_class($this->cm_conf['campaign_monitor_ClientID']); $this->model_name = WXInflections::underscore($this->model_class); } $this->sub_links["create"] = "Create New " . $this->display_name; $this->sub_links["view_subscriber"] = "View Subscribers"; $this->sub_links["view_segments"] = "View Segments"; if (!($this->this_page = WaxUrl::get("page"))) { $this->this_page = 1; } }
/** * Construct method, initialises authentication, default model and menu items **/ function __construct() { /** * authentication **/ $auth = new WaxAuthDb(array("encrypt" => false, "db_table" => $this->auth_database_table, "session_key" => "wildfire_user_cookie")); $this->current_user = $auth->get_user(); if ($this->current_user->usergroup == 30) { $this->is_admin = true; } /** * module setup **/ $this->before_filter("all", "check_authorised", array("login")); $this->configure_modules(); $this->all_modules = CMSApplication::get_modules(true, $this->current_user->usergroup); if (!array_key_exists($this->module_name, CMSApplication::get_modules())) { Session::add_message('This component is not registered with the application.'); $this->redirect_to('/admin/home/index'); } /** * model instanciation **/ if ($this->model_class) { $this->model = new $this->model_class(); $this->model_name = WXInflections::underscore($this->model_class); if (!$this->scaffold_columns && is_array($this->model->column_info())) { $this->scaffold_columns = array_keys($this->model->column_info()); } } $this->sub_links["create"] = "Create New " . $this->display_name; if (!($this->this_page = WaxUrl::get("page"))) { $this->this_page = 1; } }
/** * Clears the session data via a call to the auth object - effectively logging you out **/ public function logout() { $auth = new WaxAuthDb(array("db_table" => $this->model_name, "session_key" => "wildfire_user_cookie")); $auth->logout(); $this->redirect_to($this->unauthorised_redirect); }
/** * check to see if admin is logged in * @return boolean */ public function is_admin_logged_in() { $user = new WaxAuthDb(array("db_table" => "wildfire_user", "encrypt" => "false", "session_key" => "wildfire_user_cookie")); return $user->is_logged_in(); }