update login function
fix a bug in login
passed function
almost finished