added login method, also some fixed register

there're some bugs in registration