0.0.17 • Published 6 years ago

@codejunkies/vue-pwned-password v0.0.17

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

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

NameTypeOptionsDefaultDescription
triggerStringblur, changeblurChoose when to trigger a check.
triggerTimeNumber-500Only if trigger option is change, how long to wait after last change to check password
showToggleBooleantrue/falsetrueShow icon to toggle between password and text
showPasswordBooleantrue/falsefalseIf 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.

NameDescription
password-compromisedThe password has been checked and are compromised
password-uncompromisedThe password has been checked but are not compromised
password-uncheckedThe password has not yet been checked
password-checkingThe 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

0.0.17

6 years ago

0.0.16

6 years ago

0.0.15

6 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.6

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago

1.0.0

6 years ago