Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

check-passwords

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

check-passwords

A tool for check passwords in form fields

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 11 Apr 2017

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