开发者

CakePhp - blocking the site with Auth - how?

开发者 https://www.devze.com 2023-03-22 05:38 出处:网络
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

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.

0

精彩评论

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