generic register and login