i have a LoginController like this:
public function loginAction(){
$db = $this->_getParam('db');
$this->_helper->viewRenderer->setNoRender();
$this->_helper->getHelper('layout')->disableLayout();
$adapter = new Zend_Auth_Adapter_DbTable(
$db,
'user',
'username',
'password',
'MD5(CONCAT(?,password_salt))'
);
$adapter->setIdentity($this->_request->getParam('username'));
$adapter->setCredential($this->_request->getParam('password'));
$auth = Zend_Auth::getInstance();
$result = $auth->authenticate($adapter);
if ($result->isValid()) {
// get all info about this user from the login table ommit only the password, we don't need that
$userInfo = $adapter->getResultRowObject(null, 'password');
$users = new Application_Model_DbTable_Users();
$users->updateLastlogin($userInfo->email);
$auth->setStorage(new Zend_Auth_Storage_Session('testzf'));
$authStorage = $auth->getStorage();
$authStorage->write($userInfo);
$data = array('login'=>'success');
}
and a ProfileController:
public function getprofileAction(){
$this->_helper->viewRenderer->setNoRender();
$this->_helper->getHelper('layout')->disableLayout();
if(Zend_Auth::getInstance()->hasIdentity()) {
$username=$this->_request->getParam('username');
$db_users = new Application_Model_DbTable_Users();
$user = $db_users->getUser($username);
}
i made AjaxCalls for both Login and getprofile actions. I can login but getprofile doesn't work because Zend_Auth::getInstance()->hasIdentity() returns null. I see 2 session files in the folder as in application.ini. resources.session.save_path = APPLICATION_PATH "/../data/sessions" First one is full of session data, the second one is empty 0KB. Should this work through Ajax-Calls or i make an Error?
Regards