refs #4480 Fix: VnUser before save hook removed -> setting password attribute

This commit is contained in:
Juan Ferrer 2023-04-15 01:51:38 +02:00
parent add3a8b1fa
commit 2af48b3049
3 changed files with 4 additions and 9 deletions

View File

@ -25,11 +25,6 @@ module.exports = function(Self) {
message: `A client with that Web User name already exists`
});
Self.observe('before save', async function(ctx) {
if (ctx.currentInstance && ctx.currentInstance.id && ctx.data && ctx.data.password)
ctx.data.password = md5(ctx.data.password);
});
Self.remoteMethod('getCurrentUserData', {
description: 'Gets the current user data',
accepts: [

View File

@ -7,6 +7,7 @@
"table": "account.user"
}
},
"resetPasswordTokenTTL": "604800",
"properties": {
"id": {
"type": "number",
@ -128,4 +129,4 @@
"permission": "ALLOW"
}
]
}
}

View File

@ -5,7 +5,7 @@ const crypto = require('crypto');
const nthash = require('smbhash').nthash;
module.exports = Self => {
const shouldSync = process.env.NODE_ENV !== 'test';
const shouldSync = process.env.NODE_ENV === 'production';
Self.getSynchronizer = async function() {
return await Self.findOne({
@ -32,7 +32,6 @@ module.exports = Self => {
},
async syncUser(userName, info, password) {
let {
client,
accountConfig
@ -212,7 +211,7 @@ module.exports = Self => {
}
}
}
await applyOperations(deleteGroups, 'delete');
await applyOperations(addGroups, 'add');
},