Modifying the User model in the following way does not trigger a validation error when attempting to create a user with an invalid password:
varUser=app.models.User;User.validatesLengthOf('password',{min: 6,message: {min: 'Password is too short'}});varu=newUser({email: "foo@bar.com",password: "short"});assert(u.isValid())// ErrorTracing it with node-inspector shows that the length is being compared to the hashed password, which is obviously always quite long.
Modifying the User model in the following way does not trigger a validation error when attempting to create a user with an invalid password:
Tracing it with
node-inspectorshows that the length is being compared to the hashed password, which is obviously always quite long.