Merged PetitTetonApps with the website now that the deployment server always uses SSL. Used the Apps more recent implementation of NodeJS/Express.

This commit is contained in:
Wynne Crisman
2016-05-31 14:37:42 -07:00
parent a98d7d3a5f
commit 78be012a14
192 changed files with 58459 additions and 19 deletions

25
app/models/user.js Normal file
View File

@@ -0,0 +1,25 @@
"use strict";
var bcrypt = require('bcrypt-nodejs');
module.exports = function(sequelize, DataTypes) {
//The id field is auto added and made primary key.
return sequelize.define('User', {
login: {
type: DataTypes.STRING
},
password: {
type: DataTypes.STRING
}
}, {
freezeTableName: true, // Model tableName will be the same as the model name
instanceMethods: {
generateHash: function(password) {
return bcrypt.hashSync(password, bcrypt.genSaltSync(8), null);
},
validPassword: function(password) {
return bcrypt.compareSync(password, this.password);
}
}
});
};