D
D
Dauren S2019-03-26 07:15:04
Yii
Dauren S, 2019-03-26 07:15:04

How to change the attribute of an authorized user and save in his user session in Yii2?

After authorization, the user's attributes are stored in the session. How can I change some of the user's attributes so that when switching between pages, the attribute does not change back to the original one?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arman, 2019-03-26
@Arik

Do not store in the session?) Rather, store the user's id and password hash or the time of the last password change in order to reset the authorization if the admin changed the password. And it’s better to take it from the database every time, then always up-to-date data, one query for the primary key, I don’t think that there will be such a big load, if the project is really big, then this is another question.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question