mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-06 12:31:33 +01:00
validate email password on register
This commit is contained in:
@@ -209,15 +209,22 @@
|
||||
var uid;
|
||||
async.waterfall([
|
||||
function(next) {
|
||||
if (!userData.email) {
|
||||
return next(new Error('[[error:invalid-email]]'));
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
if (userData.username.length > meta.config.maximumUsernameLength) {
|
||||
return next(new Error('[[error:username-too-long'));
|
||||
}
|
||||
|
||||
if (!userData.password || userData.password.length < meta.config.minimumPasswordLength) {
|
||||
return next(new Error('[[user:change_password_error_length]]'));
|
||||
}
|
||||
|
||||
next();
|
||||
},
|
||||
function(next) {
|
||||
|
||||
@@ -112,7 +112,7 @@ module.exports = function(User) {
|
||||
groups.join('registered-users', userData.uid, next);
|
||||
},
|
||||
function(next) {
|
||||
if (userData.email !== undefined) {
|
||||
if (userData.email) {
|
||||
db.setObjectField('email:uid', userData.email.toLowerCase(), userData.uid, next);
|
||||
if (parseInt(userData.uid, 10) !== 1 && parseInt(meta.config.requireEmailConfirmation, 10) === 1) {
|
||||
User.email.verify(userData.uid, userData.email);
|
||||
|
||||
Reference in New Issue
Block a user