more auth tests

This commit is contained in:
Barış Soner Uşaklı
2017-05-23 17:37:16 -04:00
parent 9625f89665
commit e4714a0c58
2 changed files with 91 additions and 14 deletions

View File

@@ -97,21 +97,18 @@ function registerAndLoginUser(req, res, userData, callback) {
plugins.fireHook('filter:register.interstitial', {
userData: userData,
interstitials: [],
}, function (err, data) {
if (err) {
return next(err);
}
}, next);
},
function (data, next) {
// If interstitials are found, save registration attempt into session and abort
var deferRegistration = data.interstitials.length;
// If interstitials are found, save registration attempt into session and abort
var deferRegistration = data.interstitials.length;
if (!deferRegistration) {
return next();
}
userData.register = true;
req.session.registration = userData;
return res.json({ referrer: nconf.get('relative_path') + '/register/complete' });
});
if (!deferRegistration) {
return next();
}
userData.register = true;
req.session.registration = userData;
return res.json({ referrer: nconf.get('relative_path') + '/register/complete' });
},
function (next) {
user.create(userData, next);