Untitled
unknown
javascript
4 years ago
650 B
6
Indexable
require('dotenv').config();
const adminPassword = process.env.ADMIN_PASSWORD;
userSchema.pre("save", function (next) {
if (!validationEmail(this.email)) {
return next(setError(400, "El email debe cumplir el patro, ejemplo@ejemplo.com"))
}
if (adminPassword === this.password) {
this.password = bcrypt.hashSync(this.password, 10);
next();
} else {
return next (setError(400, "Esta no es la contraseña de los admins, si quiere disponer de este roll manda un correo electrónico a team1@gmail.com y se investigará su caso a detalle para ver si puede disponer de este roll."))
}
});Editor is loading...