Better checking of URL on login