Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

508
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!