load->helper('form'); $this->load->helper('hlp_authentication'); // Loads phrases system $this->loadPhrases([ 'global' ]); } // ----------------------------------------------------------------------------------------------------------------- // Public methods /** * @return void */ public function login() { $this->load->library('form_validation'); $this->form_validation->set_rules('username', 'Username', 'required|trim|callback_validation'); $this->form_validation->set_rules('password', 'Password', 'required|trim'); if ($this->form_validation->run()) { redirect($this->authlib->getLandingPage('/Cis4')); } else { $this->load->view('Cis/Login'); } } /** * @return boolean */ public function validation() { $username = $this->input->post('username'); $password = $this->input->post('password'); $this->load->library('AuthLib', [false]); // without authentication otherwise loooooop! $login = $this->authlib->loginLDAP($username, $password); if (isSuccess($login)) return true; $this->form_validation->set_message('validation', 'Incorrect username/password.'); return false; } /** * @return void */ public function logout() { $this->load->library('AuthLib'); $this->authlib->logout(); setcookie('fhclogout', 'fhclogout', 0, '/'); redirect(base_url('/cis/private/logout.php'), 'refresh'); } }