added timeout to login function