update login function.