Redirect to previous page after login/signup/etc and fix layout