Where to use Zend_Auth, in a model or controller?

I am working on my first user login to Zend, but I'm a little confused by Zend_Auth. All articles I read about this use it directly in the controller. But for me it makes sense to work with it in my User model, so that each controller can call these functions.

What do you guys think?

There really is very little documentation on Zend Framework models.

+3
source share
3 answers

Zend_Auth :: getInstance () will return an instance so that you can use it on any controller where you need it, make a shure to save data on a successful login, so that you do not need a model for authentication or testing if the user is authenticated. (with auth in your model it will load unnecessary clusters of the model in memory at the moments when they do not need you ..., the test, if the user is authenticated, must be placed in bootstrap)

Edit the answer you ask

, , , , loggout $_SERVER ['HTTP_REFERER "]; , , .

+1

.

' , , authenticate Zend_Auth_Adapter_Interface .

+2

- "model-view-controller" ( , ), view/controller , . ; , , . , -, , , "".

0

Source: https://habr.com/ru/post/1780443/


All Articles