Added a check for internet connection before attempting to login.