v1.18.x
barisusakli 11 years ago
parent a1624013f8
commit 519b1b7e37

@ -85,5 +85,7 @@
"not-enough-reputation-to-downvote": "You do not have enough reputation to downvote this post",
"not-enough-reputation-to-flag": "You do not have enough reputation to flag this post",
"reload-failed": "NodeBB encountered a problem while reloading: \"%1\". NodeBB will continue to serve the existing client-side assets, although you should undo what you did just prior to reloading."
"reload-failed": "NodeBB encountered a problem while reloading: \"%1\". NodeBB will continue to serve the existing client-side assets, although you should undo what you did just prior to reloading.",
"registration-error": "Registration Error"
}

@ -179,6 +179,7 @@ Controllers.register = function(req, res, next) {
data.minimumPasswordLength = meta.config.minimumPasswordLength;
data.termsOfUse = meta.config.termsOfUse;
data.regFormEntry = [];
data.error = req.flash('error')[0];
plugins.fireHook('filter:register.build', {req: req, res: res, templateData: data}, function(err, data) {
if (err && process.env === 'development') {

@ -207,14 +207,20 @@
}
}
if (!userData.username || userData.username.length < meta.config.minimumUsernameLength) {
return res.redirect(nconf.get('relative_path') + '/register?error=[[error:username-too-short]]');
} else if (!userData.username || userData.username.length > meta.config.maximumUsernameLength) {
return res.redirect(nconf.get('relative_path') + '/register?error=[[error:username-too-long]]');
}
var uid;
async.waterfall([
function(next) {
if (!userData.username || userData.username.length < meta.config.minimumUsernameLength) {
return next(new Error('[[error:username-too-short]]'));
}
next();
},
function(next) {
if (!userData.username || userData.username.length > meta.config.maximumUsernameLength) {
return next(new Error('[[error:username-too-long'));
}
next();
},
function(next) {
plugins.fireHook('filter:register.check', {req: req, res: res, userData: userData}, next);
},
@ -236,7 +242,8 @@
}
], function(err, data) {
if (err) {
return res.redirect(nconf.get('relative_path') + '/register?error=' + err.message);
req.flash('error', err.message);
return res.redirect(nconf.get('relative_path') + '/register');
}
res.redirect(nconf.get('relative_path') + (data.referrer ? data.referrer : '/'));
});

Loading…
Cancel
Save