public function authenticateAction() { $form = Editor_Forms_Login::getInstance(); $request = $this->getRequest(); if (!$this->getRequest()->isPost()) { $this->_helper->redirector('index'); } if (!$form->isValid($this->getRequest()->getPost())) { return $this->_forward('index'); } $tenant = $form->getValue('tenant'); $username = $form->getValue('username'); $password = $form->getValue('password'); $login = new Editor_Models_Login(); $login->setData($tenant, $username, $password); if ($login->isValid()) { $session = new Zend_Session_Namespace('Zend_Auth'); // Set the time of user logged in $session->setExpirationSeconds(30 * 24 * 3600); // If "remember" was marked if ((int) $form->getValue('rememberme')) { Zend_Session::rememberMe(); } // Clears user specific options which are kept in the session if a new login is made. $userOptions = new Zend_Session_Namespace('userOptions'); $userOptions->unsetAll(); $this->getHelper('FlashMessenger')->addMessage(_('Succesfully logged in')); $this->_helper->redirector('index', 'index'); } else { $this->getHelper('FlashMessenger')->setNamespace('error')->addMessage(array_pop($login->getMessages())); $this->_helper->redirector('index'); } }