finished user login function