login function is finally done