validateUserNameExists()
This commit is contained in:
parent
820e150708
commit
87c6746676
|
@ -4,6 +4,7 @@ var Config = require('./config.js').config;
|
||||||
exports.validateNonEmpty = validateNonEmpty;
|
exports.validateNonEmpty = validateNonEmpty;
|
||||||
exports.validateMessageSubject = validateMessageSubject;
|
exports.validateMessageSubject = validateMessageSubject;
|
||||||
exports.validateUserNameAvail = validateUserNameAvail;
|
exports.validateUserNameAvail = validateUserNameAvail;
|
||||||
|
exports.validateUserNameExists = validateUserNameExists;
|
||||||
exports.validateEmailAvail = validateEmailAvail;
|
exports.validateEmailAvail = validateEmailAvail;
|
||||||
exports.validateBirthdate = validateBirthdate;
|
exports.validateBirthdate = validateBirthdate;
|
||||||
exports.validatePasswordSpec = validatePasswordSpec;
|
exports.validatePasswordSpec = validatePasswordSpec;
|
||||||
|
@ -42,6 +43,18 @@ function validateUserNameAvail(data, cb) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function validateUserNameExists(data, cb) {
|
||||||
|
const invalidUserNameError = new Error('Invalid username');
|
||||||
|
|
||||||
|
if(0 === data.length) {
|
||||||
|
return cb(invalidUserNameError);
|
||||||
|
}
|
||||||
|
|
||||||
|
user.getUserIdAndName(data, (err) => {
|
||||||
|
return cb(err ? invalidUserNameError : null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function validateEmailAvail(data, cb) {
|
function validateEmailAvail(data, cb) {
|
||||||
//
|
//
|
||||||
// This particular method allows empty data - e.g. no email entered
|
// This particular method allows empty data - e.g. no email entered
|
||||||
|
|
Loading…
Reference in New Issue