Skip to content
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.
/ pass-meter Public archive

Simple password strength testing.

License

Notifications You must be signed in to change notification settings

syntaqx/pass-meter

Repository files navigation

pass-meter

Build Status microjs npm

Simple password strength testing.

Optional Dependencies

  • jQuery 1.7 or higher (needed for plugin usage)

Install

npm install @syntaqx/pass-meter

Usage

When used as either a jQuery plugin or Module, Pass-Meter only expects a single argument. If the argument is a function, it is treated as the afterTest callback option. If you need to specify additional options, you will need to provide a standard options object.

jQuery

Simple call the $.passMeter plugin on any elements you'd like. Create your own styling in the callback:

$('input[type="password"]').passMeter(function (score) {
  alert('Your password is ' + score + '% strong.');
});

Or, with additional options:

$('input[type="password"]').passMeter({
  event: 'change',
  afterTest: function (score) {
    alert('Your password is ' + score + '% strong.');
  },
});

Module

var PassMeter = require('pass-meter');

var meter = new PassMeter();
var pass = 'apasswordtotest';

console.log('The password "' + pass + '" is ' + meter.test(pass) + '% strong');

Or, with additional options:

var PassMeter = require('pass-meter');

var meter = new PassMeter({
  afterTest: function (score, value) {
    console.log('The password ' + value + ' is ' + score + '% strong');
  },
});

meter.test('apasswordtotest');

Options

Variable Default Value Description
events keyup Events to bind when using the module as a jQuery plugin
afterTest null A callback for when a test has been completed.
commonPasswords ['password', '123456', '12345678', '1234', 'qwerty'] An array of common passwords to instantly fail.

License

This project is open source available under the MIT license.

About

Simple password strength testing.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 3

  •  
  •  
  •