Redirect correctly to previous page on login

refs #1231