How can I compare password
and password_confirmation
, and if they don't match then I'll print "Passwords don't match"
to the error message?
const userSchema = new Schema(
{
username: {type: String, required: [true, "Please enter a username"], unique: [true, "Username taken"]},
password: {type: String, required: true, minLength: [8, "Minimum password lenth is 8"]},
password_confirmation: {type: String}
},
{ timestamps: true }
);