Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cakephp 3.7如何禁用身份验证错误消息_Cakephp_Cakephp 3.0 - Fatal编程技术网

Cakephp 3.7如何禁用身份验证错误消息

Cakephp 3.7如何禁用身份验证错误消息,cakephp,cakephp-3.0,Cakephp,Cakephp 3.0,我需要在应用程序中禁用auth错误消息,因为应用程序中已经实现了自定义消息,并且auth错误消息在某些地方复制了错误消息 [implementedEvents] => Array ( [Controller.initialize] => authCheck [Controller.startup] => startup ) [_config] => Array ( [authenticate] =&

我需要在应用程序中禁用auth错误消息,因为应用程序中已经实现了自定义消息,并且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
    )
下面是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
    )