Merge remote-tracking branch 'origin/main'
# Conflicts: # backend/test/user.test.js
This commit is contained in:
commit
751953ae70
|
|
@ -15,7 +15,7 @@ app.use(express.json());
|
||||||
app.use(express.urlencoded({ extended: true }));
|
app.use(express.urlencoded({ extended: true }));
|
||||||
|
|
||||||
// database
|
// database
|
||||||
const db = require("./models/index");
|
const db = require("./models");
|
||||||
const Role = db.Role;
|
const Role = db.Role;
|
||||||
const User = db.User;
|
const User = db.User;
|
||||||
const PitchType = db.PitchType;
|
const PitchType = db.PitchType;
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,15 @@ module.exports = (sequelize, DataTypes) => {
|
||||||
user.password = await bcrypt.hash(user.password, salt);
|
user.password = await bcrypt.hash(user.password, salt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
defaultScope: {
|
||||||
|
attributes: { exclude: ['password'] },
|
||||||
|
},
|
||||||
|
scopes: {
|
||||||
|
withSecretColumns: {
|
||||||
|
attributes: { include: ['password'] },
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
User.prototype.validPassword = function (password) {
|
User.prototype.validPassword = function (password) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue