/** Displays the login form and posts the username and password for validation * * @return id of the user logged in. */ public function indexAction() { $request = $this->getRequest(); $form = new Default_Form_Loginform(); if ($this->getRequest()->isPost()) { if ($form->isValid($request->getPost())) { $user = new Default_Model_User(); $user->getByUserName($request->username); if ($user->authenticateByPassword($request->password)) { $session = new Zend_Session_Namespace('user'); $session->user_id = $user->getUserId(); $this->_helper->redirector('homepage'); } else { $this->view->entries = 1; } } else { $this->view->form = $form; } } $this->view->form = $form; }