handle register and login redirects