Store document.location in cookie before logging in