refs #5762 refactor: recoverPassword use app param
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2023-08-04 14:33:38 +02:00
parent 75d3d12ae9
commit 4c199f66b2
2 changed files with 4 additions and 5 deletions

View File

@ -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;

View File

@ -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);