N
N
Nikita Kolosov2012-10-12 03:09:21
Zend Framework
Nikita Kolosov, 2012-10-12 03:09:21

Changing data in the Zend_Auth store?

standard situation. Authenticated with Zend_Auth

...<br>
        $authAdapter->setIdentity($login);<br>
        $authAdapter->setCredential($password);<br><br>
        $auth   = Zend_Auth::getInstance();<br>
        $result = $auth->authenticate($authAdapter);<br><br>
        if ($result->isValid()) {<br>
  $data = $authAdapter->getResultRowObject(null, 'password');<br>
  $auth->getStorage()->write($data);<br>
         }<br>
...<br>

Now the user has gone somewhere like "Edit Profile", changed the information, but inside the Zend_Auth singleton the data has become old.
What to do in such a case? How to deal with it? Couldn't find any info on google

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Max T, 2012-10-12
@Maksimus2000

Write your Zend_Auth_Adapter_** and Zend_Auth_Storage_**

P
pav, 2012-10-12
@pav

After changing the data, you can simply update the data of the authorization adapter instance using the setIdentity and setCredential methods.

O
Oleg Lobach, 2012-10-17
@bladeofsteel

What's stopping you from doing:

$data = $auth->getStorage()->read(); // или так Zend_Auth::getInstance()->getStorage()->read();
$data->field = $user->firld;
$auth->getStorage()->write($data);

?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question