Open joarobles opened 8 years ago
I can confirm this problem exists.
I added a triggers.enter logger and found, that after sign-in the user is randomly getting redirected to /logout again. If I try for 5-10 times, I am getting redirected to my homeRoutePath.
I found the cause of the problem: The flow-routing always stores the previous Route so that when ensureSignedIn sends a user back to sign-in, he can then be redirected to the previous page. That totally makes sense.
This just doesn't work if there is a route, which causes the user to be logged out. Then the previous route is "logout".
But this can easily be fixed:
Just name your logout route "logout" and add it to the "knownRoutes" like this:
AccountsTemplates.knownRoutes.push('logout');
That causes flow-routing to not remember the previous route. Then everything works as expected.
Yeah, that will do the trick! Thanks Marc!
Thanks @mbernath - life saver - should go to the docs!
@mbernath Thanks!! Chased this for hours while refactoring my app to replace my own accounts system with useraccounts. Your solution saved me from falling back to my own mediocre implementation for user account management.
AccountsTemplates.knownRoutes.push('logout'); That causes flow-routing to not remember the previous route.
Thanks @mbernath
I have the following configuration for useraccounts:
And this is my flow route for handling logout:
The problem is that, whenever I log out I get redirected to the sign in view (as expected) but I won't be able to login again: when I enter the right credentials no errors are shown but the form won't dissapear. Any idea?