I use CakePHP 1.3 and I want to change this message:
You are not authorized to access that location.
to (for example):
oh sorry
The message appears from this code:
echo $this->Session->flash(‘auth’);
i change app_controller to
class AppController extends Controller {
var $components = array('Auth', 'Session', 'Acl');
function beforeFilter() {
$this->Auth->authorize = 'actions';
$this->Auth->autoRedirect = false;
if ($this->params['controller'] == 'pages') {
$this->Auth->allow('*');
}
$this->Auth->allow('pages');
$this->Auth->loginError = "This message shows up when the wrong credentials are used";
$this->Auth->authError = "This error shows up with the user tries to access a part of the website that is protected.";
}
}
but yet i face same message.
When this happens, you probably have explicitly included the AuthComponent in your UsersController as well. Make sure to set the
authErrorin the UsersController beforeFilter method as well or make sure that it’s beforeFilter callsparent::beforeFilter()to include the message.