update register&login logic