Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

507
Vistas
express-validator isStrongPassword() function is not working

I'm trying to do validation test by using express-validator.

so far everything is working good except isStrongPassword()

import {check} from "express-validator"


const val =   
    check('pwd')
        .exists()
        .withMessage('please enter the password')
        .isStrongPassword({minLength: 6})
        .withMessage('password is must be above six letters')

Router.post('/signup',val,SignUp)


const SignUp = async(req,res) => {
    // if email and password are invalid  throw the errors
    const errors = validationResult(req).array();
    if (errors && errors.length) {
    console.log(errors);
    res.status(400).json({ errors });

my code is like that .but when I request password 1 letter or 7 letters regardless It just call error. It seems to be doesn`t work anybody who knows why it happened? Thank you for your attention

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

isStrongPassword has default values

enter image description here

Either you override the other properties with 0 or just follow the default values.

IMHO, a strong password should respect the combination of lower case, upper case, number, and special character, not only the minimal length.

I hope this answers your problem.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda