cp

check-passwords

A tool for check passwords in form fields

Showing:

Popularity

Downloads/wk

1

Maintenance

No Maintenance Data Available

Package

Dependencies

0

Size (min+gzip)

0.5KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

Check Passwords

Tool for check passwords in form fields using webpack and pure javascript in the client.

Installation

Via npm npm install check-passwords

Usage and API documentation

This tool is make for will used with webpack as a module.

The class CheckPasswords

It's the main class and receive as paramater an object of configuration, this object can have the following properties and method.

  • target {DOMObject}, This should be the form DOM object and is optional, if is undefined then the form DOM object will be the first form element that exists at body.
  • passwordFields {Array}, This should be the array of inputs fields type password and is optional, if is undefined then the inputs will be the first two in form.
  • onMatch {Function}, This function is called when the password in the two fields are equals.
  • onDontMatch {Function}, This function is called when the password in the two fields aren't equals.

The method watch is for listen the event blur in the second field when this change it, after that the functions onMatch and onDontMatch are called if the passwords equals or not.

Example

const CheckPasswords = require('check-passwords');

window.onload = function () {
  const MyCheckPass = new CheckPasswords({
    target: document.getElementById('form'),
    passwordFields: [
      document.querySelector('.password'),
      document.querySelector('.repear-password')
    ],
    onMatch: function () {
      // When the passwords are equals.
    },
    onDontMatch: function () {
      // When don't.
    }
  });

  // Call method watch for listen blur event in the second field.
  MyCheckPass.watch();
};

Test

You need have installed globaly webpack and execute npm run test for test the tool in your browser.

License

MIT

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100