CakeDC / users

Users Plugin for CakePHP
https://www.cakedc.com
Other
520 stars 296 forks source link

Customizing flash messages #1030

Closed tgoeminne closed 1 year ago

tgoeminne commented 1 year ago

I was looking how to customise the flash messages usage. For instance when a user is not logged in and wants to access something that they would normally be allowed to access when logged in. I don't want to show the flash messages but just redirect them to login screen. How to remove the flash message? Is there a way to easily set this in permissions or config?

rochamarcelo commented 1 year ago

You could create a custom unauthorized handler based on https://github.com/CakeDC/users/blob/11.next-cake4/src/Middleware/UnauthorizedHandler/DefaultRedirectHandler.php

For more information see: https://github.com/CakeDC/users/blob/11.next-cake4/Docs/Documentation/Authorization.md#authorization-middleware

tgoeminne commented 1 year ago

Thanks