npm/newww — pull request #50 by seldo (2014-07-29 01:46:32+00:00)
Title: Fixing the auth bug and refactoring

There were some stray references to couch.delSession and couch.setSession fixed in here, and metrics.addMetric wasn't always correctly referenced either.

Moved Login and Logout into their own file, but this is just the beginning of a bigger refactor. Wanted to get the bugfix in first before moving on to that.

Token is now retrieved from CouchSession returned by CouchLogin and passed back to setSession. On logout, the token is retrieved from the user object and passed back to CouchLogin. An ephemeral loginCouch and logoutCouch object is created for each of these actions to avoid race conditions within the worker.