title: Shorthand promise chaining
body: <p>I am trying to teach myself node and express and trying to build a simple login script. I am new to Javascript promises.</p>
  
  <p>My user Model has functions like <code>exists</code>, <code>verifiyPassword</code>, and <code>isApproved</code>. Each function looks like this:</p>
  
  <pre><code>//Simplified verifyPassword function
  User.prototype.verifyPassword=function(suppliedPassword){
      return new Promise((resolve,reject)=&gt;{
          if(suppliedPassword === this.password){
              return resolve(true);
          }
          return reject(new Error('Password incorrect'));
      })
  }
  </code></pre>
  
  <p>I want to chain a series of these methods together like so (note: I am testing using the <strong>WRONG</strong> password)  </p>
  
  <p>1st try:</p>
  
  <pre><code> user.exists()
  .then(user.verifyPassword(req.body.password)).
  .then(user.isApproved())
  .then(()=&gt;{
       console.log("Login successful");
  }).catch(err=&gt;{
        console.log("ERROR", err);
        throw err
  });
  </code></pre>
  
  <p>Result: <code>UnhandledPromiseRejectionWarning: Error: Password incorrect
  Login successful</code></p>
  
  <p>Obviously the wrong result (error wasn't caught and still made a successful login). I believe this is because <code>user.verifyPassword()</code> is not returning its promise.</p>
  
  <p>2nd try:</p>
  
  <pre><code> user.exists()
  .then(user.verifyPassword.bind(req.body.password)).
  .then(user.isApproved)
  .then(()=&gt;{
       console.log("Login successful");
  })
  </code></pre>
  
  <p>I think this might have worked but it did not pass <code>req.body.password</code> to <code>verifyPassword</code> (instead it passed <code>true</code>, the result of the <code>user.exists()</code> resolve).</p>
  
  <p>3rd try:</p>
  
  <pre><code> user.exists()
  .then(()=&gt;{return user.verifyPassword.bind(req.body.password)}).
  .then(()=&gt;{return user.isApproved})
  .then(()=&gt;{
       console.log("Login successful");
  })
  </code></pre>
  
  <p><strong>This code works</strong> as expected but feels terribly verbose. Is there a way I can clean this up? I am not very familiar with the ES6 shorthand tricks yet. </p>