Giter Club home page Giter Club logo

vue-pwned-password's Introduction

vue-pwned-password

npm version

Installation

npm install --save @codejunkies/vue-pwned-password
-or-
yarn add @codejunkies/vue-pwned-password

Demo

You can try a small demo of the component on CodeSandBox

Usage

<template>
  <div id="app">
    <pwned-password v-model="password" @checkcomplete="checkComplete"></pwned-password>
  </div>
</template>

<script>
import PwnedPassword from '@codejunkies/vue-pwned-password';

export default {
  name: 'app',
  data() {
    return {
      password: '',
    };
  },
  components: {
    PwnedPassword,
  },
  methods: {
    checkComplete(result) {
      if(result.compromised) {
        alert(`You should consider a diffrent password, this password has appeared ${result.appearances} times in password leaks.`) ;
      }
    }
  }
};
</script>

Events

The pwned-password component emits 2 events, one for every update to the field and one after the check is completed. The "checkcomplete" event returns two properits, one that indicates if the password is compromised or not, and a number that shows how many times the password has appeared in password leaks.

<pwned-password v-model="password" @checkcomplete="checkComplete" @input="handleInput"></pwned-password>

<script>
  methods: {
    checkComplete(result) {
      if(result.compromised) {
        alert(`You should consider a diffrent password, this password has appeared ${result.appearances} times in password leaks.`) ;
      }
    },
    handleInput(password) {
      console.log(`Input entered: ${password}`)
    }
  }

Props

Name Type Options Default Description
trigger String blur, change blur Choose when to trigger a check.
triggerTime Number - 500 Only if trigger option is change, how long to wait after last change to check password
showToggle Boolean true/false true Show icon to toggle between password and text
showPassword Boolean true/false false If you want to use your own toggle button (overrides "internal" toggle button)

Classes

The component will add diffrent classes to itself based on the status of the entered password.

Name Description
password-compromised The password has been checked and are compromised
password-uncompromised The password has been checked but are not compromised
password-unchecked The password has not yet been checked
password-checking The password is being checked agaisnt havibeenpwned database
.pwned-password.password-compromised .pwned-password-input {
  border-color: #900;
}

.pwned-password.password-uncompromised .pwned-password-input {
  border-color: #090;
}

.pwned-password.password-checking .pwned-password-input {
  border-color: #009;
}

Bump version npm version patch -a -m "message" && git push --tags && npm run release

vue-pwned-password's People

Contributors

ja1984 avatar tazer avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar  avatar  avatar

vue-pwned-password's Issues

Update readme

  • Add information on how to install the component
  • Add information on available setttings

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.