projects
/
oweals
/
peertube.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
08535e5
)
Don't hash user password once again on update
author
Chocobozzz
<florian.bigard@gmail.com>
Sat, 4 Nov 2017 17:09:23 +0000
(18:09 +0100)
committer
Chocobozzz
<florian.bigard@gmail.com>
Sat, 4 Nov 2017 17:09:23 +0000
(18:09 +0100)
server/models/user/user.ts
patch
|
blob
|
history
diff --git
a/server/models/user/user.ts
b/server/models/user/user.ts
index c1e7abea6cafcb19533a0ce157e1c71b95ed2aab..b974418d4ba61a8f96190984cb3cb31599141a5d 100644
(file)
--- 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
}
function beforeCreateOrUpdate (user: UserInstance) {
- return cryptPassword(user.password).then(hash => {
- user.password = hash
- return undefined
- })
+ if (user.changed('password')) {
+ return cryptPassword(user.password)
+ .then(hash => {
+ user.password = hash
+ return undefined
+ })
+ }
}
// ------------------------------ METHODS ------------------------------