public function loginAction() { $form = new Application_Form_Login(); $request = $this->getRequest(); if ($request->isPost() && $form->isValid($request->getPost())) { $adapter = new Application_Model_AuthAdapter( $this->_getParam('username'), $this->_getParam('password') ); $result = $adapter->authenticate(); if ($result->isValid()) { $_SESSION['loggedIn'] = true; $this->_redirect('/admin'); } else { $form->setDescription('Nieprawidłowy użytkownik/hasło'); } } $this->view->form = $form; }