/** * Authentication to downloader */ public function authenticate() { if (!$this->_session) { return $this; } if (!empty($_GET['return'])) { $this->set('return_url', $_GET['return']); } if ($this->_checkUserAccess()) { return $this; } if (!$this->controller()->isInstalled()) { return $this; } try { if (isset($_POST['username']) && empty($_POST['username']) || isset($_POST['password']) && empty($_POST['password'])) { $this->addMessage('error', 'Invalid user name or password'); } if (empty($_POST['username']) || empty($_POST['password'])) { $this->controller()->setAction('login'); return $this; } $user = $this->_session->login($_POST['username'], $_POST['password']); $this->_session->refreshAcl(); if ($this->_checkUserAccess($user)) { return $this; } } catch (Exception $e) { $this->addMessage('error', $e->getMessage()); } $this->controller()->redirect($this->controller()->url('loggedin'), true); }