Skip to content

Node.js based forum software built for the modern web

feat(emails): pass req in to filter:registration.interstitial

Julian Lamafd2d8dab17b
diff --git a/src/controllers/authentication.js b/src/controllers/authentication.js
index b4bc61d1a4..4af206af6a 100644
--- a/src/controllers/authentication.js
+++ b/src/controllers/authentication.js
@@ -28,6 +28,7 @@ async function registerAndLoginUser(req, res, userData) {
}
const data = await plugins.hooks.fire('filter:register.interstitial', {
+ req,
userData,
interstitials: [],
});
@@ -141,6 +142,7 @@ async function addToApprovalQueue(req, userData) {
authenticationController.registerComplete = function (req, res, next) {
// For the interstitials that respond, execute the callback with the form body
plugins.hooks.fire('filter:register.interstitial', {
+ req,
userData: req.session.registration,
interstitials: [],
}, async (err, data) => {
diff --git a/src/controllers/index.js b/src/controllers/index.js
index d480eb033b..8a54519f8d 100644
--- a/src/controllers/index.js
+++ b/src/controllers/index.js
@@ -193,6 +193,7 @@ Controllers.registerInterstitial = async function (req, res, next) {
}
try {
const data = await plugins.hooks.fire('filter:register.interstitial', {
+ req,
userData: req.session.registration,
interstitials: [],
});
diff --git a/src/middleware/user.js b/src/middleware/user.js
index cf545ab901..0d154b506c 100644
--- a/src/middleware/user.js
+++ b/src/middleware/user.js
@@ -270,7 +270,7 @@ module.exports = function (middleware) {
});
if (!allowed.includes(path)) {
// Append user data if present
- req.session.registration.uid = req.uid;
+ req.session.registration.uid = req.session.registration.uid || req.uid;
controllers.helpers.redirect(res, '/register/complete');
} else {