We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 78a045e + aafbfa7 commit c051b37Copy full SHA for c051b37
generated/server/db/models/user.js
@@ -46,8 +46,10 @@ module.exports = db.define('user', {
46
},
47
hooks: {
48
beforeCreate: function (user) {
49
- user.salt = user.Model.generateSalt();
50
- user.password = user.Model.encryptPassword(user.password, user.salt);
+ if (user.changed('password')) {
+ user.salt = user.Model.generateSalt();
51
+ user.password = user.Model.encryptPassword(user.password, user.salt);
52
+ }
53
54
beforeUpdate: function (user) {
55
if (user.changed('password')) {
0 commit comments