Skip to content

Instantly share code, notes, and snippets.

@tanepiper
Created March 6, 2014 23:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tanepiper/9402225 to your computer and use it in GitHub Desktop.
Save tanepiper/9402225 to your computer and use it in GitHub Desktop.
Instance.db.User = Instance.db.sequelize.define('user', {
email: {
type: Sequelize.STRING,
allowNull: false,
validate: {
isEmail: true
}
},
password: {
type: Sequelize.STRING,
allowNull: false
}
}, {
classMethods: {
},
instanceMethods: {
hashPassword: function(password) {
this.password = Bcrypt.hashSync(this.password, 10);
return this;
},
checkPassword: function(password) {
return Bcrypt.compareSync(password, this.password);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment