CakePhp - blocking the site with Auth - how?
I want to block the website completely - using the开发者_如何学C Auth. in the "normal" usage it is redirecting the user to the login page while it can still see the layout. i want to prevent it.
I want the unauthorized guest to see ONLY the login form
edit
I saw an option to use an empty layout in the login function, but i guess that there is another way, is there?
edit
Bumping, anyone?
Switch to a different layout in a beforeFilter
if the user is not logged in:
function beforeFilter() {
if (!$this->Auth->user()) {
$this->layout = 'anonymous';
}
}
Put this in the AppController.
The other way around works as well of course: if the user is logged in, use your "full" layout and make default.ctp
something minimalistic instead.
精彩评论