Cakephp 3.7如何禁用身份验证错误消息
我需要在应用程序中禁用auth错误消息,因为应用程序中已经实现了自定义消息,并且auth错误消息在某些地方复制了错误消息Cakephp 3.7如何禁用身份验证错误消息,cakephp,cakephp-3.0,Cakephp,Cakephp 3.0,我需要在应用程序中禁用auth错误消息,因为应用程序中已经实现了自定义消息,并且auth错误消息在某些地方复制了错误消息 [implementedEvents] => Array ( [Controller.initialize] => authCheck [Controller.startup] => startup ) [_config] => Array ( [authenticate] =&
[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
)
下面是Auth对象的详细信息
[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
)
Cake\Controller\Component\AuthComponent对象(
[组件]=>阵列
(
[0]=>RequestHandler
[1] =>闪光
)
[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
)
)
[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]=>您无权访问该位置。这是随机出现在网站上。有什么方法可以做到这一点吗?您可以使用它在控制器的
beforeFilter()或组件设置中禁用authError:
[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
)
$this->Auth->config('authError',false)代码>您可以使用此选项在控制器的beforeFilter()或组件设置中禁用authError:
[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
)
$this->Auth->config('authError',false)代码>
[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
)