Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Don't hash user password once again on update

Chocobozzz59557c466381
diff --git a/server/models/user/user.ts b/server/models/user/user.ts
index c1e7abea6c..b974418d4b 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
}
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 ------------------------------