split login&register and added api method