|
@@ -84,6 +84,7 @@ module.exports = (crowi) => {
|
|
|
|
|
|
|
|
const checkPassportStrategyMiddleware =
|
|
const checkPassportStrategyMiddleware =
|
|
|
checkForgotPasswordEnabledMiddlewareFactory(crowi, true);
|
|
checkForgotPasswordEnabledMiddlewareFactory(crowi, true);
|
|
|
|
|
+ const ALLOWED_TEMPLATE_NAMES = ['passwordReset', 'passwordResetSuccessful'];
|
|
|
|
|
|
|
|
async function sendPasswordResetEmail(
|
|
async function sendPasswordResetEmail(
|
|
|
templateFileName,
|
|
templateFileName,
|
|
@@ -92,6 +93,9 @@ module.exports = (crowi) => {
|
|
|
url,
|
|
url,
|
|
|
expiredAt,
|
|
expiredAt,
|
|
|
) {
|
|
) {
|
|
|
|
|
+ if (!ALLOWED_TEMPLATE_NAMES.includes(templateFileName)) {
|
|
|
|
|
+ throw new Error(`Invalid template name: ${templateFileName}`);
|
|
|
|
|
+ }
|
|
|
const templatePath = resolveLocalePath(
|
|
const templatePath = resolveLocalePath(
|
|
|
locale,
|
|
locale,
|
|
|
crowi.localeDir,
|
|
crowi.localeDir,
|