From 4c199f66b2641d76c8154844551d07c98cf61fe3 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 4 Aug 2023 14:33:38 +0200 Subject: [PATCH] refs #5762 refactor: recoverPassword use app param --- back/methods/vn-user/recover-password.js | 6 +++--- back/models/vn-user.js | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/back/methods/vn-user/recover-password.js b/back/methods/vn-user/recover-password.js index b5d183ba3..b0f7122b4 100644 --- a/back/methods/vn-user/recover-password.js +++ b/back/methods/vn-user/recover-password.js @@ -9,7 +9,7 @@ module.exports = Self => { required: true }, { - arg: 'directory', + arg: 'app', type: 'string', description: 'The directory for mail' } @@ -20,7 +20,7 @@ module.exports = Self => { } }); - Self.recoverPassword = async function(user, directory) { + Self.recoverPassword = async function(user, app) { const models = Self.app.models; const usesEmail = user.indexOf('@') !== -1; @@ -34,7 +34,7 @@ module.exports = Self => { } try { - await Self.resetPassword({email: user, emailTemplate: 'recover-password', directory}); + await Self.resetPassword({email: user, emailTemplate: 'recover-password', app}); } catch (err) { if (err.code === 'EMAIL_NOT_FOUND') return; diff --git a/back/models/vn-user.js b/back/models/vn-user.js index 7b919ec29..cf210b61b 100644 --- a/back/models/vn-user.js +++ b/back/models/vn-user.js @@ -101,8 +101,7 @@ module.exports = function(Self) { hedera: 'verificationToken=$token$' }; - // FIXME: Change with: info.options?.app - const app = info.options?.directory; + const app = info.options?.app; let recoverHash = app ? recoverHashes[app] : defaultHash; recoverHash = recoverHash.replace('$token$', info.accessToken.id);