You are here

function password_policy_constraint_punctuation_js in Password Policy 7

Same name and namespace in other branches
  1. 6 constraints/constraint_punctuation.inc \password_policy_constraint_punctuation_js()

Javascript portion.

File

constraints/constraint_punctuation.inc, line 40
Password policy constraint callbacks.

Code

function password_policy_constraint_punctuation_js($constraint, $account) {
  return <<<JS

    var count = (value.match(/[`~!@#\$%^&*()_+=\\-|}{"?:><,./;'\\\\[\\]]/g) || []).length;
    if (count < {<span class="php-variable">$constraint</span>}) {
      strength = 'low';
      msg.push(translate.constraint_punctuation);
    }
JS;
}