[Bugfix] Redirect to current page when login
We should solve the problem with authentication redirection. Currently, accessing any channel or notification of a non-public channel doesn't work properly if the user is not authenticated or the SSO session is expired. Example:
- A user receives a notification email
- The user clicks on it to access it
- A
Channel doesn't exist error
appears - User clicks on login and logs in
- The user is redirected to the channels list instead of to the notification or channel s/he wanted to check
I think we should solve this since it could be a little bit annoying for users to have to go back to the email and click again on the notification to be able to see it. I guess by storing the lastURLvisited
on localSotrage
and some extra logic when isAuthenticated
and !channelPublic
we could solve it, by redirecting the user again to the lastURLvisited
once s/he logs in. Also, we could improve the error message by displaying something like You can't visit this channel, try to log in first
when the user is not logged in because it could be somehow confusing that a channel that you know exists or you receive a notification displays this error and maybe you don't realize your session was expired.
Maybe the culprit is: https://gitlab.cern.ch/push-notifications/web-portal/-/blob/master/src/auth/pages/redirectPage/RedirectPage.js#L16