From f0cc239865893acf46a13420081e581152f73d1f Mon Sep 17 00:00:00 2001 From: Hamid Reside Date: Fri, 4 Oct 2019 10:33:43 +0400 Subject: [PATCH] feat: Add zxcvbn user_inputs prop * feature-user-inputs * Read me Update --- README.md | 1 + src/components/PasswordStrengthMeter.vue | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dc058b7..4ac1e7c 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,7 @@ Interactive password strength meter based on [zxcvbn](https://github.com/dropbox | labelHide | String | 'Hide Password' | Label for the hide icon | labelShow | String | 'Show Password' | Label for the show icon | autocomplete | String | 'new-password' | Input field autocomplete property +| userInput | Array | empty array | Array of strings that zxcvbn will treat as an extra dictionary ## Events diff --git a/src/components/PasswordStrengthMeter.vue b/src/components/PasswordStrengthMeter.vue index 8e1e4bc..6a5ae5d 100644 --- a/src/components/PasswordStrengthMeter.vue +++ b/src/components/PasswordStrengthMeter.vue @@ -250,6 +250,13 @@ labelHide: { type: String, default: 'Hide Password' + }, + /** + * @type String + */ + userInputs: { + type: Array, + default: [] } }, data () { @@ -281,7 +288,7 @@ * @return {Number} Password Strength Score */ passwordStrength () { - return this.password ? zxcvbn(this.password).score : null + return this.password ? zxcvbn(this.password, (this.userInputs.length >= 1 ? this.userInputs : null)).score : null }, /**