title: Bookshelf.js is changing the password on every update to data using bcrypt
body: <p>My User Model is </p>
  
  <pre><code>var Bookshelf = require('../../db').bookshelf;
  var bcrypt = require('bcrypt');
  var Promise  = require('bluebird');
  var Base = require('./../helpers/base');
  
  // User model
  var User_Model = Bookshelf.Model.extend({
      tableName: 'users',
      initialize: function() {
          this.on('saving', this.hashPassword, this);
      },
      hashPassword: function(model, attrs, options) {
          return new Promise(function(resolve, reject) {
              bcrypt.hash(model.attributes.password, 10, function(err, hash) {
                  if( err ) reject(err);
                  model.set('password', hash);
                  resolve(hash); // data is created only after this occurs
              });
          });
      }
  });
  </code></pre>
  
  <p>On creating the user the password is set to</p>
  
  <pre><code>$2a$10$QD6FmChgGZEMooCklLfemOvAaHHV2RfUMQ5EoNwuMeojb6y2Hh2iK
  </code></pre>
  
  <p>And working perfectly on login,</p>
  
  <p>When any update is made to the user field, it causes the password change everytime to random value</p>
  
  <pre><code>$2a$10$IVW.2JN/TPVABsx73t870uwKMNsDKoGmLJzOs1y/MPMOe.WRMBL4W
  
  $2a$10$12sjEqM3t345dcq7rDixgu.9TZiWOC.JN5Ke8SI2F0IXv/YpdRwTK
  </code></pre>