password meter
by Sambora
HTML
<input id="password" name="password" type="text" />
47
CSS
#password {
padding: 10px;
border: 1px solid #000;
margin: 0 0 10px;
}
div.pass-container {
height: 30px;
}
div.pass-bar {
height: 11px;
margin-top: 2px;
}
div.pass-hint {
font-family: arial;
font-size: 11px;
}
JavaScript
/*
---
name: StrongPass.js
description: checks password strength of a string
authors: Dimitar Christoff12345612345611444
license: MIT-style license.
version: 1.0.3
requires:
- Core/String
- Core/Element
- Core/DOMEvent
- Core/Class
- Core/Array
provides: StrongPass
...
*/
(function(){
'use strict';
var StrongPass = new Class({
Implements: [Options, Events],
options: {
minChar: 6, // too short while less than this
passIndex: 2, // Weak
// output verdicts, colours and bar %
label: 'Password strength: ',
verdicts: [
'Too Short',
'Very weak',
'Weak',
'Good',
'Strong',
'Very strong'
],
colors: [
'#ccc',
'#500',
'#800',
'#f60',
'#050',
'#0f0'
],
width: [
'0%',
'10%',
'30%',
'60%',
'80%',
'100%'
],
// tweak scores here
scores: [
10,
15,
25,
45
],
// when in banned list, verdict is:
bannedPass: 'Not allowed',
// styles
passStrengthZen: 'div.pass-container',
passbarClassZen: 'div.pass-bar', // css controls
passbarHintZen: 'div.pass-hint',
// output
render: true, // it can just report for your own implementation
injectTarget: null,
injectPlacement: 'after'
},
bannedPasswords: [
// see study here: http://smrt.io/JlNfrH
'123456',
'12345',
'123456789',
'password',
'iloveyou',
'princess',
'rockyou',
'1234567',
'12345678',
'abc123',
'nicole',
'daniel',
'babygirl',
'monkey',
'jessica',
'lovely',
'michael',
'ashley',
'654321',
'qwerty',
'password1',
'welcome',
'welcome1',
'password2',
'password01',
'password3',
'p@ssw0rd',
'passw0rd',
'password4',
'password123',
'summer09',
'password6',
'password7',
'password9',
'password8',
'welcome2',
'welcome01',
'winter12',
'spring2012',
'summer12',
'summer2012'
],
/**
* @constructor
* @param {DOMElement} element Base...