Node.js based forum software built for the modern web
feat: allow file uploading on registration interstitial
Andrew Rodriguesddffc904f4ec
diff --git a/install/package.json b/install/package.jsonindex 1219685acf..6298e37a5f 100644--- a/install/package.json+++ b/install/package.json@@ -90,9 +90,9 @@"nodebb-plugin-spam-be-gone": "0.6.1","nodebb-rewards-essentials": "0.0.13","nodebb-theme-lavender": "5.0.9",- "nodebb-theme-persona": "9.1.29",+ "nodebb-theme-persona": "9.1.30","nodebb-theme-slick": "1.2.23",- "nodebb-theme-vanilla": "10.1.25",+ "nodebb-theme-vanilla": "10.1.26","nodebb-widget-essentials": "4.0.17","nodemailer": "^6.0.0","passport": "^0.4.0",diff --git a/src/controllers/authentication.js b/src/controllers/authentication.jsindex 061359394c..41d1316852 100644--- a/src/controllers/authentication.js+++ b/src/controllers/authentication.js@@ -152,6 +152,7 @@ authenticationController.registerComplete = function (req, res, next) {var callbacks = data.interstitials.reduce(function (memo, cur) {if (cur.hasOwnProperty('callback') && typeof cur.callback === 'function') {+ req.body.files = req.files;memo.push(function (next) {cur.callback(req.session.registration, req.body, function (err) {// Pass error as second argument so all callbacks are executeddiff --git a/src/routes/authentication.js b/src/routes/authentication.jsindex 11e8c03432..49f6233ac2 100644--- a/src/routes/authentication.js+++ b/src/routes/authentication.js@@ -120,6 +120,11 @@ Auth.reloadRoutes = function (router, callback) {});});+ var multipart = require('connect-multiparty');+ var multipartMiddleware = multipart();+ var middlewares = [multipartMiddleware, Auth.middleware.applyCSRF, Auth.middleware.applyBlacklist];++ router.post('/register', middlewares, controllers.authentication.register);router.post('/register', Auth.middleware.applyCSRF, Auth.middleware.applyBlacklist, controllers.authentication.register);router.post('/register/complete', Auth.middleware.applyCSRF, Auth.middleware.applyBlacklist, controllers.authentication.registerComplete);router.post('/register/abort', controllers.authentication.registerAbort);