Wire up login handler, fix redirects and login tests