2amigos / yii2-usuario

Highly customizable and extensible user management, authentication, and authorization Yii2 extension
https://github.com/2amigos/yii2-usuario
Other
294 stars 142 forks source link

About flash messages and trigger event #281

Open bscheshirwork opened 5 years ago

bscheshirwork commented 5 years ago

What steps will reproduce the problem?

Some action set flash message before run trigger, but I can see 2 poin who set flash message after trigger. Of course I use only this action :smile_cat:

What is the expected result?

same behavior for all place All like this: is before https://github.com/2amigos/yii2-usuario/blob/5181bbc60a2c72aa37344a260e39cd6f6211a803/src/User/Controller/RegistrationController.php#L195-L197 Or all is after

What do you get instead?

This is after only... https://github.com/2amigos/yii2-usuario/blob/5181bbc60a2c72aa37344a260e39cd6f6211a803/src/User/Controller/RegistrationController.php#L233-L240

https://github.com/2amigos/yii2-usuario/blob/5181bbc60a2c72aa37344a260e39cd6f6211a803/src/User/Controller/RecoveryController.php#L168-L170

bscheshirwork commented 5 years ago

related #280

tonydspaniard commented 5 years ago

@bscheshirwork I think is a good addition. As soon as the translations messages are updated on the PR #280 I'll merge.

bscheshirwork commented 5 years ago

So... This behavior (message after trigger)... Is this done intentionally?

bscheshirwork commented 5 years ago

i.e. don't show message if trigger fail?

tonydspaniard commented 5 years ago

https://github.com/2amigos/yii2-usuario/blob/5181bbc60a2c72aa37344a260e39cd6f6211a803/src/User/Controller/RegistrationController.php#L243

bscheshirwork commented 5 years ago

I tell about case https://github.com/2amigos/yii2-usuario/blob/5181bbc60a2c72aa37344a260e39cd6f6211a803/src/User/Controller/RegistrationController.php#L233-L240

where functional inside trigger is terminate application. In this case message has not write into session.

tonydspaniard commented 5 years ago

@bscheshirwork Why a user would terminate the application from the event? Thats not really logic.

bscheshirwork commented 5 years ago

https://github.com/yiisoft/yii2/blob/f2212a3183b4e8cc6629729916f17475903aec44/framework/filters/Cors.php#L111-L115

bscheshirwork commented 5 years ago

For example. Application will terminate in many places.

Becouse I can do trhis. Becouse I can define logic in config w/o redefine class https://github.com/bscheshirwork/yii2-app-advanced-redis/blob/7cdce8086d8be6d548ab0dea473bb5712b3b0384/backend/config/main.php#L52-L76