Skip to content

Node.js based forum software built for the modern web

closes #2391

psychobunnyd69054804e35
diff --git a/src/routes/authentication.js b/src/routes/authentication.js
index 979e08c1bc..c485586fa3 100644
--- a/src/routes/authentication.js
+++ b/src/routes/authentication.js
@@ -118,6 +118,12 @@
return res.redirect(nconf.get('relative_path') + '/register' + (err.message ? '?error=' + err.message : ''));
}
+ if (userData.username.length < meta.config.minimumUsernameLength) {
+ return res.redirect(nconf.get('relative_path') + '/register?error=[[error:username-too-short]]');
+ } else if (userData.username.length > meta.config.maximumUsernameLength) {
+ return res.redirect(nconf.get('relative_path') + '/register?error=[[error:username-too-long]]');
+ }
+
user.create(userData, function(err, uid) {
if (err || !uid) {
return res.redirect(nconf.get('relative_path') + '/register');