Added a Try loop to catch bad authentication

I also made it so that the message window only opens if the username
and password have been authenticated.