简体   繁体   中英

ZF2 - update user profile page

I am building a website using Zend Framework 2, managing authentication with ZfcUser. Now I'm working on a page where a registered user can update his profile data.

I noticed that even after the user updated his data via a form, and the data are written to the database, the method getIdentity of Zend\\Authentication\\AuthenticationService still returns the old data because it stores them in session.

How can I get the new data without having to logout the user?

After your update has been successful:

$authenticationService->getStorage()->write($newIdentity);

Now you've updated your identity to match, however, I'd be very careful about a system that can dynamically shift identity. Identity should hopefully be unique and persistent. Not to say you CAN'T do it, but make sure you've covered your bases so no one can assume other identities.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM