我需要在应用程序中禁用身份验证错误消息,因为在应用程序中已经实现了自定义消息,并且身份验证错误消息正在某些地方复制错误消息。
下面是Auth对象的详细信息
Cake \ Controller \ Component \ AuthComponent对象( [components] =>数组 ( [0] => RequestHandler [1] => Flash )
[implementedEvents] => Array ( [Controller.initialize] => authCheck [Controller.startup] => startup ) [_config] => Array ( [authenticate] => Array ( [0] => Form ) [authorize] => [ajaxLogin] => [flash] => Array ( [element] => error [key] => flash [params] => Array ( [class] => error ) ) [loginAction] => Array ( [controller] => Users [action] => login [plugin] => ) [loginRedirect] => [logoutRedirect] => [authError] => You are not authorized to access that location. [unauthorizedRedirect] => 1 [storage] => Session [checkAuthIn] => Controller.startup )
)
我要禁用[authError] =>您无权访问该位置。这是随机出现在网站上。有什么办法吗?
答案 0 :(得分:0)
您可以使用它在控制器的beforeFilter()
或组件设置中禁用authError:
$this->Auth->config('authError', false);