Updates to the website to remove Yaks and AP classes; Updates to the admin site to support user management (not working fully yet).

This commit is contained in:
Wynne Crisman
2016-07-20 15:11:55 -07:00
parent 83a831736a
commit 3340dc7e34
30 changed files with 1400 additions and 1666 deletions

View File

@@ -5,6 +5,12 @@ var bcrypt = require('bcrypt-nodejs');
module.exports = function(sequelize, DataTypes) {
//The id field is auto added and made primary key.
return sequelize.define('User', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
allowNull: false,
autoIncrement: true
},
login: {
type: DataTypes.STRING
},
@@ -15,17 +21,22 @@ module.exports = function(sequelize, DataTypes) {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true
},
}
}, {
indexes: [
{
unique: true,
fields: ['login']
}
]
}, {
],
freezeTableName: true, // Model tableName will be the same as the model name
//paranoid: true, //Keep deleted data but flag it as deleted
comment: "A system user authorized to access and manipulate the application data.",
classMethods: {
generateHash: function(password) {
return bcrypt.hashSync(password, bcrypt.genSaltSync(8), null);
}
},
instanceMethods: {
generateHash: function(password) {
return bcrypt.hashSync(password, bcrypt.genSaltSync(8), null);