feat: allow file uploading on registration interstitial

v1.18.x
Andrew Rodrigues 6 years ago
parent 8778f00b69
commit ddffc904f4

@ -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",

@ -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 executed

@ -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);

Loading…
Cancel
Save