Author: | DavideTriso |
---|---|
Views Total: | 710 views |
Official Page: | Go to website |
Last Update: | December 19, 2017 |
License: | MIT |
Preview:

Description:
Just another pure JavaScript plugin used for generating strong random password strings with just one click.
How to use it:
The html for the password generator.
<label for="blocks-length">Blocks length <input type="number" min="1" max="10" value="4" id="blocks-length"> </label> <label for="blocks">Number of blocks <input type="number" min="1" max="10" value="4" id="blocks"> </label> <label for="blocks-separator">Blocks separator <input type="text" id="blocks-separator" value="-"> </label> <button type="button" id="generate-passwd">Suggest Password</button>
Create an element to display the generated password.
<output id="wrapper"></output>
Include the main JavaScript on the web page when needed.
<script src="generate-passwd.js"></script>
The JavaScript to activate the password generator.
function testGeneratePasswd() { var wrapper = document.getElementById('wrapper'), blocksLength = document.getElementById('blocks-length').value, blocksNumber = document.getElementById('blocks').value, blocksSeparator = document.getElementById('blocks-separator').value, passwd = generatePasswd({ blocksLength: blocksLength, blocksNumber: blocksNumber, blocksSeparator: blocksSeparator }); wrapper.innerHTML = passwd; } document.getElementById('generate-passwd').addEventListener('click', function() { testGeneratePasswd(); });