Commit 669565f3 authored by Vincent Pelletier's avatar Vincent Pelletier

erp5_jquery_plugin_validation: Tolerant more repetitions in passwords.

Also, expose and document unicity score divisor.
parent 19188308
......@@ -128,7 +128,17 @@ function PasswordValidator() {\n
window.PasswordValidator = PasswordValidator;\n
\n
\n
/* Uniqueness is a reweard for not reusing the same character several times.\n
* SCORE_UNIQUE increase this reward, SCORE_UNIQUE_DIVISOR is the divisor\n
* used to determine the score of repetitions. */\n
PasswordValidator.prototype.SCORE_UNIQUE = 1;\n
/* Obviously:\n
* - zero is will cause errors\n
* - negative values will give non-linear scores\n
* - values between zero and one will reward for repetitions (you do not want\n
* this)\n
* - use Infinity to only reward unique chars */\n
PasswordValidator.prototype.SCORE_UNIQUE_DIVISOR = 1.5;\n
PasswordValidator.prototype.SCORE_UPPER = 1;\n
PasswordValidator.prototype.SCORE_LOWER = 1;\n
/* Password variety is the number of unique chars in it. Score is computed\n
......@@ -173,7 +183,7 @@ PasswordValidator.prototype.PADDING = "\\x00";\n
PasswordValidator.prototype.RANGE_BASE = "too-weak";\n
/* Above-weakest range definition, as threshold and range name pairs. */\n
PasswordValidator.prototype.RANGE_THRESHOLDS = [\n
[55, "weak"],\n
[54, "weak"],\n
[70, "medium"],\n
[90, "strong"]\n
];\n
......@@ -280,7 +290,7 @@ PasswordValidator.prototype.getScore = function (value, tracer) {\n
character_score = this.SCORE_UNIQUE;\n
}\n
lazy_tracer(value_index, "variety:", character_score);\n
variety_map[current_lower] = character_score / 2;\n
variety_map[current_lower] = character_score / this.SCORE_UNIQUE_DIVISOR;\n
new_sequences = [];\n
sequence_matched = false;\n
for (i = 0; i < sequences.length; i += 1) {\n
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment