Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

vue-password-strength-meter

apertureless32.3kMIT1.7.2

Interactive password strength meter based on zxcvbn

vue.js, Vue, password, password strength, security

readme

🔓 vue-password-strength-meter

Build Status npm version vue2 license

ko-fi

Interactive password strength meter based on zxcvbn for vue.js

🔓

📺 Demo

Demo here

🔧 Install

yarn add vue-password-strength-meter zxcvbn

👈 Usage


<template>
  <password v-model="password"/>
</template>

<script>
  import Password from 'vue-password-strength-meter'
  export default {
    components: { Password },
    data: () => ({
      password: null
    })
  }
</script>

👈 With events


<template>
  <password
    v-model="password"
    :toggle="true"
    @score="showScore"
    @feedback="showFeedback"
  />
</template>

<script>
  import Password from 'vue-password-strength-meter'
  export default {
    components: { Password },
    data: () => ({
      password: null
    }),
    methods: {
      showFeedback ({suggestions, warning}) {
        console.log('🙏', suggestions)
        console.log('⚠', warning)
      },
      showScore (score) {
        console.log('💯', score)
      }
    }
  }
</script>

With custom input

<template>
  <div>
    <input type="password" v-model="password">
    <password v-model="password" :strength-meter-only="true"/>
  </div>
</template>

<script>
  import Password from 'vue-password-strength-meter'
  export default {
    components: { Password },
    data: () => ({
      password: null
    })
  }
</script>

Props

Prop Type Default Value Description
secureLength Number 7 password min length
badge Boolean true display password count badge
toggle Boolean false show button to toggle password visibility
showPassword Boolean false If you are not using the toggle button you can directly show / hide the password with this prop
defaultClass String Password__field input field class
disabledClass String Password__field--disabled disabled input field class
errorClass String Password__badge--error error class for password count badge
successClass String Password__badge--success success class for password count badge
strengthMeterClass String Password__strength-meter strength-meter class
strengthMeterFillClass String Password__strength-meter--fill strength-meter class for individual data fills
showStrengthMeter Boolean true Hide the Strength Meter if you want to implement your own
strengthMeterOnly Boolean false Hides the built-in input if you want to implement your own
labelHide String 'Hide Password' Label for the hide icon
labelShow String 'Show Password' Label for the show icon
userInputs Array empty array Array of strings that zxcvbn will treat as an extra dictionary
referenceValue String 'input' Prop to change the ref of the input. This way you can have the input outside of the component.

Events

Show / Hide Password

  • @show will be emitted if showing the password
  • @hide will be emitted if hiding the password
  • @score will return the zxcvbn score (Integer from 0-4) [ℹ] (https://github.com/dropbox/zxcvbn#usage)
  • @feedback will return an zxcvbn feedback object with suggestion and warning

💅 Customizing

You can customize the styling of the input field, badge and strength-meter by passing your own css classes to defaultClass, strengthMeterClass etc.

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

# run unit tests
npm run unit

# run all tests
npm test

For detailed explanation on how things work, checkout the guide and docs for vue-loader.

Support

Buy Me A Coffee

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

1.7.2 (2020-04-30)

Bug Fixes

  • Add missing inheritAttrs: false so the root element does not bind attributes (92dab66), closes #48
  • Remove "show password" button from tabbing index (#47) (fe30cc6)

1.7.0 (2020-02-06)

Features

1.6.1 (2019-11-06)

Bug Fixes

  • Change default user_input prop value to factory function (#44) (b27a568)

1.6.0 (2019-11-01)

Features

  • Add zxcvbn user_inputs prop (f0cc239)

1.5.0 (2019-08-25)

Bug Fixes

Features

1.4.2 (2019-03-18)

Bug Fixes

  • Add missing production env to remove dev settings (4a21c74), closes #33

1.4.1 (2019-01-07)

Bug Fixes

  • strength-meter: Fix responsive behaviour breaks (#29) (#30) (6ced855)
  • Add missing emit event type if only strength-meter is active (ed135c9), closes #32

1.4.0 (2018-12-27)

Features

  • ✨ Allow the usage of built-in input to be optional (#19) (b2201bc)
  • Add blur and focus events (6031382)
  • Add props for the icon labels (12c6d01), closes #26

1.3.2 (2018-08-29)

Bug Fixes

  • prevent toggleButton from getting called on input enter (#23) (5cf25a2), closes #21

1.3.1 (2018-08-29)

Bug Fixes

  • labels: Fix show/hide labels (74789c3)

1.3.0 (2018-07-18)

Features

  • strengh-meter: Add showStrengthMeter prop to show/hide the strength meter(#16) (efd8a00)
  • add « disabled » and « disabledClass » prop (#15) (0bb6240)
  • Make the ref attribute listen to a prop so user change it (#17) (d245016)

1.2.1 (2018-04-09)

Bug Fixes

  • button: Add prevent to toggle button click event (1759628)

1.2.0 (2018-04-09)

Features

  • password: Add toggle for show / hide password and more events (5fa79e1)

Change Log

v0.1.1 (2017-01-19)

Full Changelog

v0.1.0 (2017-01-14)

* This Change Log was automatically generated by github_changelog_generator