Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

509
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda