input->set('view', 'login'); $this->input->set('layout', 'default'); parent::display(); } /** * Method to log in a user. * * @return void */ public function login() { // Check for request forgeries. JSession::checkToken('request') or jexit(JText::_('JINVALID_TOKEN')); $app = JFactory::getApplication(); $model = $this->getModel('login'); $credentials = $model->getState('credentials'); $return = $model->getState('return'); $result = $app->login($credentials, array('action' => 'core.login.admin')); if (!($result instanceof Exception)) { $app->redirect($return); } parent::display(); } /** * Method to log out a user. * * @return void */ public function logout() { JSession::checkToken('request') or jexit(JText::_('JInvalid_Token')); $app = JFactory::getApplication(); $userid = $this->input->getInt('uid', null); $options = array( 'clientid' => ($userid) ? 0 : 1 ); $result = $app->logout($userid, $options); if (!($result instanceof Exception)) { $model = $this->getModel('login'); $return = $model->getState('return'); $app->redirect($return); } parent::display(); } }