update register and login function