fix email

This commit is contained in:
lefuturiste 2020-07-31 13:07:31 +00:00
parent d41551c806
commit bac5347c65
3 changed files with 12 additions and 10 deletions

View file

@ -29,10 +29,7 @@ class AllowedString extends mongoose.SchemaType {
const email = {
type: String,
validate: {
validator: function(v: string) {
console.log(v)
return /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(v);
},
validator: (v: string) => /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(v),
message: "Invalid email"
}
}