users icon indicating copy to clipboard operation
users copied to clipboard

Normalize Flash message usages in LoginTrait

Open steinkel opened this issue 10 years ago • 6 comments

Check other traits too

steinkel avatar Mar 27 '16 16:03 steinkel

Why? I don't understand this issue.

thinkingmedia avatar Mar 29 '16 13:03 thinkingmedia

Some Flash messages use the "auth" key in LoginTrait, we should use the either default or auth flash messages across the Plugin.

steinkel avatar Mar 29 '16 14:03 steinkel

Make it configurable. I can't say if it should have a key or not. I know that I render the default in my layout.ctp in my apps. Having to keep track of flash keys is a pain.

thinkingmedia avatar Mar 29 '16 14:03 thinkingmedia

@steinkel AuthComponent already has a configuration option for this.

The AuthComponent has defaults for flash like this.

        $defaults = [
            'authenticate' => ['Form'],
            'flash' => [
                'element' => 'default',
                'key' => 'auth',
                'params' => ['class' => 'error']
            ],
            'loginAction' => [
                'controller' => 'Users',
                'action' => 'login',
                'plugin' => null
            ],
            'logoutRedirect' => $this->_config['loginAction'],
            'authError' => __d('cake', 'You are not authorized to access that location.')
        ];

As long as the AuthComponent is loaded before the plugin. The plugin can just $controller->Auth->config('flash.key'); to get the value.

thinkingmedia avatar Apr 03 '16 13:04 thinkingmedia

looks like the core is forcing us to fix this now with the upgrade to 3.4 :+1:

steinkel avatar Mar 01 '17 10:03 steinkel