src/clientAuth.js
function(username, pw) {
    return _.ajax({
      verb: 'POST',
      url: '/login',
      data: {
        username: username,
        password: pw
      }
    }).then(function(id) {
      document.cookie = 'user=' + id;
      return id;
    });
  }
function(username, pw) {
    return _.ajax({
      verb: 'POST',
      url: '/login',
      data: {
        username: username,
        password: pw
      }
    }).then(function(id) {
      document.cookie = 'user=' + id;
      return id;
    });
  }
function ( username , pw ) { return _ . ajax ( { verb : 'POST' , url : '/login' , data : { username : username , password : pw } } ) . then ( function ( id ) { document . cookie = 'user=' + id ; return id ; } ) ; }
Return a promise that resolves to a user ID if authorization was successful
Return a promise that resolves to a user ID if authorization was successful