add login function and auth function