brendanashworth / generate-password

NodeJS library for generating cryptographically-secure passwords.
MIT License
354 stars 67 forks source link

Sometimes does not generate number into password #44

Closed andredicioccio closed 4 years ago

andredicioccio commented 4 years ago

Hi there, I've noticed that sometimes when I generate passwords, even though I specify numbers: true, it does not add a number into the generated password.

For example when using:

    var password = generator.generate({
      length: 10,
      numbers: true
    });
    console.log(password);

I get this outcome (notice for example the second password generated has no number):

image

brendanashworth commented 4 years ago

@andredicioccio , please take a look at a past issue for help on this:

You should take a look at the strict: true flag, that will always include a lowercase and uppercase letter in passwords. This is not on by default. More info here: #19 (comment)

Enabling the strict flag will solve this problem for you.