jQuery Password Generator Plugin - pGenerator

jQuery Password Generator Plugin - pGenerator
File Size: 5.98 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

pGenerator is a jQuery plugin that helps you create a Password Generator for your accounts forms that generates a secure password and display it to your user.

Basic Usage:

1. Include jQuery library and pGenerator.js in the head section

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="pGenerator.jquery.js"></script>

2. Markup

<input type="password" id="my-input-element" /> 
<a href="#" id="demo">Generate a password</a>
<!--Display the new generated password;-->
<div id="my-display-element"></div>

3. Call the plugin with options

$('#demo').pGenerator({

  // Bind an event to #myLink which generate a new password when raised;
  'bind': 'click', 

  // Selector for the form input which will contain the new generated password;
  'passwordElement': '#my-input-element', 

  // Selector which will display the new generated password;
  'displayElement': '#my-display-element',

  // Length of the generated password.
  'passwordLength': 16, 

  // Password will contain uppercase letters;
  'uppercase': true, 

  // Password will contain lowercase letters;
  'lowercase': true, 

  // Password will contain numerical characters;
  'numbers':   true, 

  // Password will contain numerical characters;
  'specialChars': true, 

  // Extra special chars
  'additionalSpecialChars': [],

  // Callback function which will be called each time a new password is generated;
  'onPasswordGenerated': function(generatedPassword) {
    alert('My new generated password is ' + generatedPassword); 
  }
  
});

Change log:

2017-03-15

  • The plugin now supports adding extra special chars using the additionalSpecialChars new setting.

v1.0.2 (2013-09-11)

  • bugs fixed

This awesome jQuery plugin is developed by M1Sh0u. For more Advanced Usages, please check the demo page or visit the official website.