Add two distinct password reset routes

This commit is contained in:
Johannes Zellner
2021-10-27 18:36:28 +02:00
parent daf212468f
commit 9a80049d36
4 changed files with 62 additions and 3 deletions
+4 -2
View File
@@ -152,8 +152,10 @@ async function sendNewLoginLocation(user, loginLocation) {
await sendMail(mailOptions);
}
async function passwordReset(user, resetLink) {
async function passwordReset(user, email, resetLink) {
assert.strictEqual(typeof user, 'object');
assert.strictEqual(typeof email, 'string');
assert.strictEqual(typeof resetLink, 'string');
const mailConfig = await getMailConfig();
const translationAssets = await translation.getTranslations();
@@ -167,7 +169,7 @@ async function passwordReset(user, resetLink) {
const mailOptions = {
from: mailConfig.notificationFrom,
to: user.fallbackEmail,
to: email,
subject: ejs.render(translation.translate('{{ passwordResetEmail.subject }}', translationAssets.translations || {}, translationAssets.fallback || {}), { cloudron: mailConfig.cloudronName }),
text: render('password_reset-text.ejs', templateData, translationAssets),
html: render('password_reset-html.ejs', templateData, translationAssets)