refs #5762 refactor: recoverPassword use app param
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
75d3d12ae9
commit
4c199f66b2
|
@ -9,7 +9,7 @@ module.exports = Self => {
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'directory',
|
arg: 'app',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
description: 'The directory for mail'
|
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 models = Self.app.models;
|
||||||
|
|
||||||
const usesEmail = user.indexOf('@') !== -1;
|
const usesEmail = user.indexOf('@') !== -1;
|
||||||
|
@ -34,7 +34,7 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await Self.resetPassword({email: user, emailTemplate: 'recover-password', directory});
|
await Self.resetPassword({email: user, emailTemplate: 'recover-password', app});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err.code === 'EMAIL_NOT_FOUND')
|
if (err.code === 'EMAIL_NOT_FOUND')
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -101,8 +101,7 @@ module.exports = function(Self) {
|
||||||
hedera: 'verificationToken=$token$'
|
hedera: 'verificationToken=$token$'
|
||||||
};
|
};
|
||||||
|
|
||||||
// FIXME: Change with: info.options?.app
|
const app = info.options?.app;
|
||||||
const app = info.options?.directory;
|
|
||||||
let recoverHash = app ? recoverHashes[app] : defaultHash;
|
let recoverHash = app ? recoverHashes[app] : defaultHash;
|
||||||
recoverHash = recoverHash.replace('$token$', info.accessToken.id);
|
recoverHash = recoverHash.replace('$token$', info.accessToken.id);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue