Commit 862e2a83 authored by Vytor Calixto's avatar Vytor Calixto 👾
Browse files

Validação para código da matéria

parent 9a73f528
......@@ -13,4 +13,8 @@ var Materia = new Schema({
}
})
Materia.path('codigo').validate(function(value) {
return /\b[a-zA-Z][a-zA-Z][0-9]+\b/.test(value)
}, 'Class code validation failed')
module.exports = mongoose.model('Materia', Materia)
......@@ -68,7 +68,7 @@ Usuario.methods.checkPassword = function(password) {
return this.encryptPassword(password) === this.hashedPassword
}
Usuario.path('email').validate(function (value) {
Usuario.path('email').validate(function(value) {
return /[\s\S]*@?ufpr.br/.test(value)
}, 'E-mail validation failed')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment