public function authAction()
{
$request = $this->getRequest();
$registry = Zend_Registry::getInstance();
$auth = Zend_Auth::getInstance();
$DB = Zend_Db_Table::getDefaultAdapter();
$authAdapter = new Zend_Auth_Adapter_DbTable($DB);
$authAdapter->setTableName('user')
->setIdentityColumn('user_name')
->setCredentialColumn('password');
// Set the input credential values
$uname = $request->getParam('user_name');
$paswd = $request->getParam('password');
$authAdapter->setIdentity($uname);
$authAdapter->setCredential(md5($paswd));
// Perform the authentication query, saving the result
$result = $auth->authenticate($authAdapter);
if($result->isValid())
{
$data = $authAdapter->getResultRowObject(null,'password');
$auth->getStorage()->write($data);
$this->_redirect('user/index/listuser');
}
else
{
$this->_flashMessenger->addMessage($this->view->translator('user_invalid_login'));
$this->_redirect('user/index/login');
}
}
Wednesday, February 5, 2014
Zend auth checking
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment