*8843* Fix localhost and non-standard port domain use

Two problems with the previous pull request #169:
 - Using non-standard ports, the port number would come in with the domain and cause all logins to fail.
 - With Chrome (and possibly others), a domain of 'localhost' is rejected by the browser (see http://stackoverflow.com/questions/1134290/cookies-on-localhost-with-explicit-domain)