function _isStrongEnough()

in source/services/admin/lib/generatePassword.js [9:27]


function _isStrongEnough(password) {
    const uppercaseMinCount = 1;
    const lowercaseMinCount = 1;
    const numberMinCount = 2;
    const UPPERCASE_RE = /([A-Z])/g;
    const LOWERCASE_RE = /([a-z])/g;
    const NUMBER_RE = /([\d])/g;
    const NON_REPEATING_CHAR_RE = /([\w\d\?\-])\1{2,}/g;

    let uc = password.match(UPPERCASE_RE);
    let lc = password.match(LOWERCASE_RE);
    let n = password.match(NUMBER_RE);
    let nr = password.match(NON_REPEATING_CHAR_RE);
    return password.length >= this.MIN_PASSWORD_LENGTH &&
        !nr &&
        uc && uc.length >= uppercaseMinCount &&
        lc && lc.length >= lowercaseMinCount &&
        n && n.length >= numberMinCount;
}