views:

27

answers:

1

Hi,

on my project website users are able to login and move from page to page on my site by being logged in. so they do not have to log in again for moving to another section on my page. to achieve that I use the storage of Zend_Auth.

Following code shows how I write storage:

$authAdapter->setIdentity($email)
        ->setCredential($password);

...

$identity = $authAdapter->getResultRowObject(); 
$authStorage = $auth->getStorage();
$authStorage->write($identity);

Now I try to read this storage in another controller:

$auth = Zend_Auth::getInstance();
$authStorage = $auth->getStorage();
$user = $authStorage->read()->email;

...but $user stays null. any ideas how to solve that problem?

A: 

This line jumped out at me:

$user = $authStorage->read()->email;

It doesnt appear that you set the "email" anywhere but a username and password for a person.

Try this

print_r($authStorage->read());
Kieran Andrews
thanks, that helps. But the source of the problem was another.in my bootstrap file where I register my acl plugin I had the following line that had no use $this->_auth = Zend_Auth::getInstance();so I removed the line and no I can read the auth storage. however do you have any idea why $this->_auth = Zend_Auth::getInstance(); coused the problem?
ArtWorkAD