Parse the URI instead so we can just pass it a rough and ready string
Test with redirects
Redirect to the requested page if we log in successfully
Redirect to the page the user logged in from in the same way as PHP
Revert "Test with redirects"

This reverts commit 747dd369cc98045e30feab5f50d785c4c2f5764e.

It's more trouble than it's worth to test redirects. All the compare
stuff needs to be updated to follow the redirects and it's just too
fiddly so I'm reverting this.