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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user