DarkLeafyGreen
DarkLeafyGreen

Reputation: 70416

Read AuthStorage, Zend Framework

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?

Upvotes: 0

Views: 2166

Answers (1)

Kieran Andrews
Kieran Andrews

Reputation: 5885

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());

Upvotes: 1

Related Questions