I’m new at this… please help.
What is wrong with this code?
Accounts.validateNewUser((user) => {
if(user.username && user.username.length < 4 && user.username.length > 16) {
throw new Meteor.Error(403, 'Username must have 4 to 16 characters.')
}
if(user.username === 'root' && user.username === 'admin') {
throw new Meteor.Error(403, 'Username cannot be root or admin.')
}
return true
})
My limited experience in this says, if username is less than 4 or greater than 16, throw and error (exit). if username is root or admin, throw an error (exit). if none of the above, return true. How come now, when I try a username that’s supposed to pass still fails? Also, how come my error message is still general one provided by Meteor?