Redirect to login page if necessary.