Filter

Hello, when some actions are denied to particular kind of user, how to display messages like "Please log in…" instead of "Error 403. You are no authorized to perform this action."




function acceessRules()

{

array('allow'

'actions'=>array('comment'),

'users'=>array('@'),

),

}



As far as I understand, if you’ve used the built in authorisation methods, a user will be redirected to your login page if they aren’t logged in already and they attempt to access a protected resource. They will be redirected to their requested page after they log in successfully.

The user should only see the error page if they’re already logged in but don’t have the required permissions.

This is how all of my sites have worked and I haven’t had to do any customisation to achieve it. I’d suggest checking through the guide to determine if you’ve missed any steps to enable this functionality:

http://www.yiiframework.com/doc/guide/1.1/en/topics.auth