diff options
Diffstat (limited to 'server/models/user')
-rw-r--r-- | server/models/user/user.ts | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/server/models/user/user.ts b/server/models/user/user.ts index c1e7abea6..b974418d4 100644 --- a/server/models/user/user.ts +++ b/server/models/user/user.ts | |||
@@ -136,10 +136,13 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da | |||
136 | } | 136 | } |
137 | 137 | ||
138 | function beforeCreateOrUpdate (user: UserInstance) { | 138 | function beforeCreateOrUpdate (user: UserInstance) { |
139 | return cryptPassword(user.password).then(hash => { | 139 | if (user.changed('password')) { |
140 | user.password = hash | 140 | return cryptPassword(user.password) |
141 | return undefined | 141 | .then(hash => { |
142 | }) | 142 | user.password = hash |
143 | return undefined | ||
144 | }) | ||
145 | } | ||
143 | } | 146 | } |
144 | 147 | ||
145 | // ------------------------------ METHODS ------------------------------ | 148 | // ------------------------------ METHODS ------------------------------ |