/** * authenticate() - defined by Zend_Auth_Adapter_Interface. This method is called to * attempt an authenication. Previous to this call, this adapter would have already * been configured with all nessissary information to successfully connect to a database * table and attempt to find a record matching the provided identity. * * @throws Zend_Auth_Adapter_Exception if answering the authentication query is impossible * @return Zend_Auth_Result */ public function authenticate() { $model = new Default_Model_User(); $result = false; foreach ($model->getAll() as $key => $user) { if ($user['handle'] == $this->_identity && $user['password'] == $this->_credential) { $result = (object) $user; } } $code = Zend_Auth_Result::FAILURE; $messages = array(); if ($result === false || $result->active === 0) { $code = Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND; $messages[] = 'A record with the supplied identity could not be found.'; } elseif ($this->_credential !== $result->password) { $code = Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID; $messages[] = 'Supplied credential is invalid.'; } else { unset($result->password); $this->_resultRow = $result; $code = Zend_Auth_Result::SUCCESS; $messages[] = 'Authentication successful.'; } return new Zend_Auth_Result($code, $this->_identity, $messages); }
public function indexAction() { $m_user = new Default_Model_User(); $all = $m_user->getAll(); $pa = Zend_Paginator::factory($all); $pa->setItemCountPerPage(25); $pa->setPageRange(5); $current = $this->_request->getParam('page'); $pa->setCurrentPageNumber($current); $this->view->kq = $pa; }
public function indexAction() { $model = new Default_Model_User(); $this->view->data = $model->getAll(); }