bapinney / fcc-bp-pclone

freeCodeCamp Pintrest Clone

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Have app redirect users, after auth, to the page they were on previously

bapinney opened this issue · comments

When a user who is not signed in gets to a page that requires him/her to be signed in, he/she is presented with a page that notifies the user he/she needs to be signed in to view it. The message instructs the user to click the Sign In link in the navbar to sign in.

After the user is signed in, however, he/she gets directed to '/' and not the page the user was at before signing in. HTML5 Web Storage should be used to set an item in sessionStorage when the user is at a page displaying that sign in notice. The item set will be the page they are trying to view. When returning from auth, the loginRtn page will check if that item is set. If that item is set, the UA will clear that item out of sessionStorage after redirecting the user to the value of that sessionStorage item.

This will allow users to go back to the page they were trying to view before they were signed in.