New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vue-password-checker

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-password-checker

A password strength checker for Vue js

  • 1.2.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Vue Password Checker

A configurable password strength checker for Vue js

Github Repo
NPM

Installation

Vue password checker can be installed with both npm and yarn as usual.

npm install vue-password-checker

yarn add vue-password-checker

And then can be imported into your project.

import 'PasswordChecker' from "vue-password-checker";

Configuration

Vue Password checker takes the following props for configuration:

password

Type: String The variable to be checked.

required

font

Type: Boolean
Used to define the font the text will use.

default: false

colors

Type: Object Used to define the colors the strength bar and text will use.

default:

{
   invalid: '#000',
   very_weak: '#FFF',
   weak: '#d44137',
   good: '#e36e0e',
   strong: '#c4c934',
   very_strong: '#24ed09',
}

show-instructions

Type: Boolean When true, a list will be shown instructing what counts as strong password.

default: false

length

Type: Number
The minimum length the password checker should look for.

default: 6

Functions

In order to get the strength value for the password the component is tracking, you can use the getStrength() function, a value from 0 to 100 is returned.

<template>
  <div>
    <password-checker ref="checker" :password="password" show-instructions>
      <label for="password">Password</label>
      <input id="password" type="password" v-model="password">
    </password-checker>
  </div>
</template>

<script>
import PasswordChecker from "vue-password-checker";
export default {
  name: "App",
  data(){
    return{
      password: '',
    }
  },
  components: {
    PasswordChecker,
  },
  mounted:{
    //Writes the password strength value to console
    console.log(this.$refs.checker.getStrength()); 
  }
}
</script>

Example

The password checker has a slot for inputs to sit in so can be used in this way:

<template>
  <div>
    <password-checker :password="password" show-instructions>
      <label for="password">Password</label>
      <input id="password" type="password" v-model="password">
    </password-checker>
  </div>
</template>

<script>
import PasswordChecker from "vue-password-checker";
export default {
  name: "App",
  data(){
    return{
      password: '',
    }
  },
  components: {
    PasswordChecker,
  }
}
</script>

Or separately

<template>
  <div>
    <password-checker :password="password" show-instructions></password-checker>

    <label for="password">Password</label>
    <input id="password" type="password" v-model="password">
  </div>
</template>

<script>
import PasswordChecker from "./src/PasswordChecker";
export default {
  name: "App",
  data(){
    return{
      password: '',
    }
  },
  components: {
    PasswordChecker,
  }
}
</script>

Keywords

FAQs

Package last updated on 14 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc