Skip to content

Commit

Permalink
Missed in last push
Browse files Browse the repository at this point in the history
  • Loading branch information
cam8001 committed Apr 3, 2022
1 parent a74e12a commit b32d576
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/PasswordGenerator.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { WordList } = require('./WordList');

const MIN_PASS_LENGTH = 7;
const MAX_PASS_LENGTH = 12;
const MIN_PASS_LENGTH = 10;
const MAX_PASS_LENGTH = 64;

class PasswordGenerator {
constructor(config = PasswordGenerator.getDefaultConfig()) {
Expand All @@ -24,9 +24,9 @@ class PasswordGenerator {
// The maximum size of a random number used in the password.
random_number_max: 99,
// Minimum password length.
min_password_length: 10,
min_password_length: MIN_PASS_LENGTH,
// Maximum password length.
max_password_length: 64,
max_password_length: MAX_PASS_LENGTH,
};
}

Expand Down
6 changes: 5 additions & 1 deletion test/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const pgLib = require('../lib/PasswordGenerator');

test('Generate test', (t) => {
t.comment('------------------------------');
t.plan(2);
t.plan(3);

const pass1 = pg.generatePassword();
t.equal(pg.validatePassword(pass1), true, `Autogenerated password ${pass1} is NZISM compliant`);
Expand All @@ -14,6 +14,10 @@ test('Generate test', (t) => {
const err = new Error('Password is invalid');
t.throws(() => {passgen.getPassword(badpassword)}, err, 'Bad password throws exception');

const rand1 = pgLib.PasswordGenerator.randomNumber();
const rand2 = pgLib.PasswordGenerator.randomNumber();
t.true(rand1 !== rand2, `Random number generator is random: ${rand1} different to ${rand2}`);

t.comment('------------------------------');
});

Expand Down

0 comments on commit b32d576

Please sign in to comment.