All Projects → skegel13 → Vue Password

skegel13 / Vue Password

A Vue.js password input component that includes a toggle to show the password and a customizable strength meter.

Projects that are alternatives of or similar to Vue Password

Serialized Editor
A Vue.js component for editing data that has been serialized in PHP
Stars: ✭ 54 (-42.55%)
Mutual labels:  vue-component
Vue Showdown
📃 Use showdown as a vue component
Stars: ✭ 74 (-21.28%)
Mutual labels:  vue-component
Diagram Vue
A editable SVG-based diagram component for Vue
Stars: ✭ 86 (-8.51%)
Mutual labels:  vue-component
Primevue
The Most Complete Vue UI Component Library
Stars: ✭ 1,085 (+1054.26%)
Mutual labels:  vue-component
Pwned Passwords Django
Utilities for working with the Pwned Passwords database from Django.
Stars: ✭ 71 (-24.47%)
Mutual labels:  password-strength
Vue Draggablecal
Not your ordinary datepicker. A Vuejs draggable date selector with a fresh responsive design, mobile ready and 0 dependencies, 17kb gzipped
Stars: ✭ 79 (-15.96%)
Mutual labels:  vue-component
Vue Social Sharing
A renderless Vue.js component for sharing links to social networks, compatible with SSR
Stars: ✭ 1,071 (+1039.36%)
Mutual labels:  vue-component
Vue Toastr
Vuejs Toast : Plugin and Component Capability.
Stars: ✭ 93 (-1.06%)
Mutual labels:  vue-component
Vue Numeral Filter
Vue.js filter for Numeral.js 🔢 🔣
Stars: ✭ 73 (-22.34%)
Mutual labels:  vue-component
Vue Qrcode Reader
A set of Vue.js components for detecting and decoding QR codes.
Stars: ✭ 1,240 (+1219.15%)
Mutual labels:  vue-component
Vue Numeric Input
Number input component with controls
Stars: ✭ 63 (-32.98%)
Mutual labels:  vue-component
Vue Agile
🎠 A carousel component for Vue.js
Stars: ✭ 1,167 (+1141.49%)
Mutual labels:  vue-component
Vue Particles
Vue.js component for particles backgrounds ✨
Stars: ✭ 1,220 (+1197.87%)
Mutual labels:  vue-component
Haveibeenpwned Zxcvbn Lambda Api
Deploy your own secure API to estimate password strength and check haveibeenpwned for known matches - HTTPS by force, server not required, fire and brimstone sold separately 🔥
Stars: ✭ 57 (-39.36%)
Mutual labels:  password-strength
Ui Predicate
Finally a Predicate/Rule Editor UI component for the Web 🚀
Stars: ✭ 86 (-8.51%)
Mutual labels:  vue-component
Kokk
Create a beautiful doc from a markdown file. You can insert a vue component into the doc as well.
Stars: ✭ 54 (-42.55%)
Mutual labels:  vue-component
Dumb Passwords
Don't let your user be a victim of their own action
Stars: ✭ 77 (-18.09%)
Mutual labels:  password-strength
Vue Core Image Upload
a vue plugin for image to crop and upload
Stars: ✭ 1,321 (+1305.32%)
Mutual labels:  vue-component
Xcui
🍴 A Vue.js 2.x desktop components colletion
Stars: ✭ 88 (-6.38%)
Mutual labels:  vue-component
Vue Cobra
🐍 Reading position indicator for Vuejs
Stars: ✭ 81 (-13.83%)
Mutual labels:  vue-component

vue-password 3.x

View Demo

Please note, VuePassword 3.x removes support for the zxcvbn library. The library appears to no longer be maintained. If you would still like to use it, you can still pull in the library and pass the VuePassword value to it to calculate the strength. Examples coming soon.

Install

Install the package using npm.

npm install --save vue-password

The VuePassword component adds support for a toggle to hide and show the password as well as a meter to show the current strength of the password. This component does not automatically calculate the strength, however, a library like zxcvbn can be used to pass the strength values as props.

import VuePassword from 'vue-password';

export default {
    ...
    components: {
        VuePassword,
    },
    ...
};

Usage

Use the props in your HTML and apply a v-model attribute for the password and any additional props for the desired configuration. The password input uses the $attrs attributes, so form validation props such as required, minlength, and maxlength will function on the input element. The following example shows how vue-password could be used in a registration form using Tailwind CSS.

Javascript

import Vue from 'vue'
import VuePassword from 'vue-password'

new Vue({
  el: '#app',
  components: {
    VuePassword
  },
  data {
    user: {
      email: '',
      password: ''
    }
  }
})

HTML

<form>
    <div class="mb-4">
        <label for="password">Password</label>
        <VuePassword
            v-model="password1"
            id="password1"
            :strength="strength"
            type="text"
        />
    </div>
</form>

Props

Use the following props to configure the password input.

Prop Default Description
classes 'form-control' Set the classes for the input element. The default is the 'form-control' class used by Twitter Bootstrap. A string or array of classes can be passed in the prop.
disableStrength false Disable the password strength meter and messages.
disableToggle false Disable the password input toggle to show/hide the password.
strengthClasses ['VuePassword--very-weak', 'VuePassword--weak', 'VuePassword--medium', 'VuePassword--good', 'VuePassword--great'] Set the classes used to style the strength message and strength meter. This should be an array of five classes. The classes are applied depending on the current strength score of the password (0-4).
strengthMessages ['Very Weak Password', 'Weak Password', 'Medium Password', 'Strong Password' 'Very Strong Password'] Set the messages that appear depending on the strength score of the password. This should be an array of five messages.

Events

The password input emits an input event to use with v-model. Other events are binded use v-on="listeners".

Slots

Named slots can be used to change the layout of the password toggle, strength meter, and strength messages.

Slot Scope Description
password-input
  • strength: Strength value
  • type: Current element type ('password or text')
  • updatePassword: Method to update the password value.
  • value: Current password value
Use this to replace the input element. The content provided by the slot must include an input field, preferably of type password.
password-toggle toggle: Method to change the input type attribute from 'password' to 'type' Use this named slot to change the layout of the password toggle.
password-hide Use this named slot to change the password hide icon.
password-show Use this named slot to change the password show icon.
strength-meter
  • strength: Strength value
  • strength-class: Current strength class
  • strength-classes: The array of strength classes
  • strength-message: Current strength message
  • strength-messages: The array of strength messages
Use this named slot to change the layout of the password strength meter.

Example: Use custom input

<VuePassword
    v-model="user.password"
>
    <div
        v-slot:password-input="props"
        class="control has-icons-left"
    >
        <input
            class="input"
            type="password"
            placeholder="Text input"
            :value="props.value"
            @input="props.updatePassword"
        />
    </div>
</VuePassword>

Custom Strength Example

HTML

<form>
    <label for="password">Password</label>
    <VuePassword
        v-model="user.password"
        :strength="score"
        @input="updateStrength"
    />
</form>

Javascript

import VuePassword from 'vue-password'

new Vue({
    el: '#app',
    components: {
        VuePassword,
    },
    data: {
        score: 0,
        user: {
            password: ''
        }
    },
    methods: {
        updateStrength(password) {
            /**
             * The input event sends the current password and
             * any included user inputs (email in this case).
             *
             * Calculate the score here either using a custom
             * javascript library or a request to the server.
             *
             * The strength must be an integer between 0 and 4.
             */
        }
    }
});
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].