开发者

CakePHP empty login function

In everything CakePHP app I have worked with recently, the login function is empty so how on earth does the login functionality work?? I presume somehow Cake is defaulting, not sure how 开发者_如何学运维it knows to even default it, but where is/are these defaults?

i.e function login() {}


look at the auth component https://github.com/cakephp/cakephp/blob/master/cake/libs/controller/components/auth.php#L680


The whole magic happens in the startup() callback of the AuthComponent. That method is triggered before the controller action is executed. It checks if there is POST data in the defined format (data[UserModel][usernameField], etc.), validates it against the User model and redirects you to loginRedirect, if it was successful.

CakePHP knows on which controller/action pair to act through the $loginAction property you can set to the AuthComponent.


http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html

i hope this tutorial will be useful for user login management

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜