Redirect to the last visited page on sign in

Also keeps the parameters used in the original page. This is important so
the chat token passed in the parameters is maintained after a sign in.