-
Notifications
You must be signed in to change notification settings - Fork 27
/
index.html
591 lines (544 loc) · 33.4 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap Strength Meter</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="docs/css/bootstrap-3.2.0.min.css">
<link rel="stylesheet" type="text/css" href="docs/css/bootstrap-example.css">
<link rel="stylesheet" type="text/css" href="docs/css/prettify.css">
<script type="text/javascript" src="docs/js/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="docs/js/bootstrap-3.2.0.min.js"></script>
<script type="text/javascript" src="password-score/dist/js/password-score.js"></script>
<script type="text/javascript" src="password-score/dist/js/password-score-options.js"></script>
<script type="text/javascript" src="dist/js/bootstrap-strength-meter.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript">
MathJax.Hub.Config({
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
<script type="text/javascript" src="docs/js/prettify.js"></script>
<script type="text/javascript">
$(document).ready(function() {
window.prettyPrint() && prettyPrint();
});
</script>
</head>
<body data-spy="scroll" data-target="#affix">
<a href="https://github.com/davidstutz/bootstrap-strength-meter"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub"></a>
<div class="container">
<div class="row">
<div class="col-md-3" id="affix">
<ul class="nav nav-pills nav-stacked sidebar" data-spy="affix" style="margin-top: 40px;">
<li class="active"><a href="#getting-started">Getting Started</a></li>
<li><a href="#drivers-options">Drivers & Options</a></li>
<li><a href="#license">License</a></li>
</ul>
</div>
<div class="col-md-9">
<h1>Bootstrap Strength Meter</h1>
<p>
Bootstrap Strength Meter is intended to demonstrate the usage of <a href="" target="_blank">Password Score</a> - a JavaScript library used to give a realistic estimate of the strength of a password.
</p>
<p>Consider <a href="http://davidstutz.de/donate/">donating</a> to support development.</p>
<p class="alert alert-info">
<b>Note that documentation is not complete yet. Check <code>boostrap-strength-meter</code> for details!</b>
</p>
<div class="page-header">
<h2><a id="getting-started"></a>Getting Started</h2>
</div>
<ol>
<li>
<h3>Include Required Files</h3>
<p>
First, all dependencies need to be included: <a href="" target="_blank">jQuery</a>, <a href="" target="_blank">Twitter Bootstrap</a> and <a href="" target="_blank">Password Score</a>.
</p>
<pre class="linenums prettyprint">
<!-- Twitter Bootstrap CSS: -->
<link rel="stylesheet" type="text/css" href="docs/css/bootstrap.css">
<script type="text/javascript" src="docs/js/jquery.js"></script>
<script type="text/javascript" src="docs/js/bootstrap.js"></script>
<script type="text/javascript" src="password-score/dist/js/password-score.js"></script>
<script type="text/javascript" src="password-score/dist/js/password-score-options.js"></script>
<script type="text/javascript" src="dist/js/bootstrap-strength-meter.js"></script>
</pre>
</li>
<li>
<h3>Setup Required HTML</h3>
<p>
Depending on the used configuration options, the required markup may vary - see <a href="#drivers-options">Drivers & Options</a>. For this example we assume that the strength of the password should be displayed as text:
</p>
<pre class="linenums prettyprint">
<form class="form-horizontal">
<div class="form-group">
<label class="form-label col-sm-2">Email</label>
<div class="col-sm-10">
<input type="text" placeholder="Email ..." class="form-control" />
</div>
</div>
<div class="form-group">
<label class="form-label col-sm-2">Password</label>
<div class="col-sm-4">
<input type="text" placeholder="Password ..." class="form-control" id="example-getting-started-input" />
</div>
<div class="col-sm-6" id="example-getting-started-text" style="font-weight:bold;padding:6px 12px;">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button class="btn btn-primary">Login</button>
</div>
</div>
</form>
</pre>
</li>
<li>
<h3>Call Plugin</h3>
<p>
The plugin offers several so called drivers - options that allow to display the password strength differently. The following example shows how to use the <code>text</code> driver:
</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-getting-started-input').strengthMeter('text', {
container: $('#example-getting-started-text')
});
});
</script>
<form class="form-horizontal">
<div class="form-group">
<label class="form-label col-sm-2">Email</label>
<div class="col-sm-4">
<input type="text" placeholder="Email ..." class="form-control" />
</div>
</div>
<div class="form-group">
<label class="form-label col-sm-2">Password</label>
<div class="col-sm-4">
<input type="text" placeholder="Password ..." class="form-control" id="example-getting-started-input" />
</div>
<div class="col-sm-6" id="example-getting-started-text" style="font-weight:bold;padding:6px 12px;">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button class="btn btn-primary">Login</button>
</div>
</div>
</form>
</div>
<div class="highlight">
<pre class="linenums prettyprint">
<script type="text/javascript">
$(document).ready(function() {
$('#example-getting-started-input').strengthMeter('text', {
container: $('#example-getting-started-text')
});
});
</script>
</pre>
</div>
</li>
</ol>
<div class="page-header">
<h2><a id="drivers-options"></a>Drivers & Options</h2>
</div>
<table class="table">
<tbody>
<tr>
<th colspan="2"><code>text</code> driver</th>
</tr>
<tr>
<td colspan="2">The <code>text</code> driver will display the password strength as text - ranging from "ridiculus" over "good" to "very strong" and applying corresponding classes: <code>.text-danger</code>, <code>.text-warning</code> and <code>.text-success</code>. The <code>text</code> driver offers the below configuration options.</td>
</tr>
<tr>
<td><code>container</code></td>
<td>
<p>
The container the text is displayed in. Usually, a <code>div</code> or <code>span</code> near the corresponding password input is a good choice. An example can be seen in <a href="#getting-started">Getting Started</a>.
</p>
<p class="alert alert-info">
Per default, the text will be appended to the password input's parent element.
</p>
</td>
</tr>
<tr>
<td><code>hierarchy</code></td>
<td>
<p>
This option allows to control the text begin displayed and the class being applied on its parent <code>span</code>. The default settings look as follows:
</p>
<pre class="prettyprint linenums">
hierarchy: {
'0': ['text-danger', 'ridiculous'],
'25': ['text-danger', 'very weak'],
'50': ['text-warning', 'weak'],
'75': ['text-warning', 'good'],
'100': ['text-success', 'strong'],
'125': ['text-success', 'very strong']
}
</pre>
<p>
The keys refer to the score needed to change the text and its corresponding class. This means that a password with a score between 10 and 20 will be declared as "very weak". For this purpose it is useful to understand what the score means: A score of $h$ means that a maximum of $2^h$ attempts are necessary to crack the password. The higher $h$ the stronger the password.
</p>
<p>
An example is shown below (where relatively weak passwords are declared "strong"):
</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-text-hierarchy-input').strengthMeter('text', {
container: $('#example-text-hierarchy-text'),
hierarchy: {
'0': ['text-danger', 'Think about a stronger password!'],
'25': ['text-warning', 'Well, you are doing better ...'],
'50': ['text-warning', 'Keep going ...'],
'75': ['text-success', 'Ok, this will do!']
}
});
});
</script>
<form class="form-horizontal">
<div class="form-group">
<label class="form-label col-sm-2">Password</label>
<div class="col-sm-4">
<input type="text" placeholder="Password ..." class="form-control" id="example-text-hierarchy-input" />
</div>
<div class="col-sm-6" id="example-text-hierarchy-text" style="font-weight:bold;padding:6px 12px;">
</div>
</div>
</form>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
<script type="text/javascript">
$(document).ready(function() {
$('#example-text-hierarchy-input').strengthMeter('text', {
container: $('#example-text-hierarchy-text'),
hierarchy: {
'0': ['text-danger', 'Think about a stronger password!'],
'25': ['text-warning', 'Well, you are doing better ...'],
'50': ['text-warning', 'Keep going ...'],
'75': ['text-success', 'Ok, this will do!']
}
});
});
</script>
<form class="form-horizontal">
<div class="form-group">
<label class="form-label col-sm-2">Password</label>
<div class="col-sm-4">
<input type="text" placeholder="Password ..." class="form-control" id="example-hierarchy-input" />
</div>
<div class="col-sm-6" id="example-text-hierarchy-text" style="font-weight:bold;padding:6px 12px;">
</div>
</div>
</form>
</pre>
</div>
</td>
</tr>
<tr>
<th colspan="2"><code>tooltip</code> driver</th>
</tr>
<tr>
<td colspan="2">
<p>
The <code>tooltip</code> driver will display the password strength in a tooltip.
</p>
<p class="alert alert-info">
This driver requires Twitter Bootstrap's <code>tooltip.js</code> to be included.
</p>
<p>
A basic example of this driver can be seen below.
</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-tooltip').strengthMeter('tooltip');
});
</script>
<form class="form-horizontal">
<div class="form-group">
<label class="form-label col-sm-2">Password</label>
<div class="col-sm-4">
<input type="text" placeholder="Password ..." class="form-control" id="example-tooltip" />
</div>
</div>
</form>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
<script type="text/javascript">
$(document).ready(function() {
$('#example-tooltip').strengthMeter('tooltip');
});
</script>
<form class="form-horizontal">
<div class="form-group">
<label class="form-label col-sm-2">Password</label>
<div class="col-sm-4">
<input type="text" placeholder="Password ..." class="form-control" id="example-text-hierarchy-input" />
</div>
</div>
</form>
</pre>
</div>
</td>
</tr>
<tr>
<td><code>hierarchy</code></td>
<td>
<p>
This option allows to control the text begin displayed. The default options look as follows:
</p>
<pre class="prettyprint linenums">
hierarchy: {
'0': 'ridiculous',
'25': 'very weak',
'50': 'weak',
'75': 'good',
'100': 'strong',
'125': 'very strong'
}
</pre>
<p>
The keys refer to the score needed to change the text. This means that a password with a score between 10 and 20 will be declared as "very weak". For this purpose it is useful to understand what the score means: A score of $h$ means that a maximum of $2^h$ attempts are necessary to crack the password. The higher $h$ the stronger the password.
</p>
<p>
An example is shown below (where relatively weak passwords are declared "strong"):
</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-tooltip-hierarchy').strengthMeter('tooltip', {
hierarchy: {
'0': ['Think about a stronger password!'],
'25': ['Well, you are doing better ...'],
'50': ['Keep going ...'],
'75': ['Ok, this will do!']
},
tooltip: {
viewport: '#example-tooltip-hierarchy-viewport'
}
});
});
</script>
<form class="form-horizontal">
<div class="form-group">
<label class="form-label col-sm-2">Password</label>
<div class="col-sm-4" id="example-tooltip-hierarchy-viewport">
<input type="text" placeholder="Password ..." class="form-control" id="example-tooltip-hierarchy" />
</div>
</div>
</form>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
<script type="text/javascript">
$(document).ready(function() {
$('#example-tooltip-hierarchy').strengthMeter('tooltip', {
hierarchy: {
'0': ['Think about a stronger password!'],
'25': ['Well, you are doing better ...'],
'50': ['Keep going ...'],
'75': ['Ok, this will do!']
},
tooltip: {
viewport: '#example-tooltip-hierarchy-viewport'
}
});
});
</script>
<form class="form-horizontal">
<div class="form-group">
<label class="form-label col-sm-2">Password</label>
<div class="col-sm-4" id="example-tooltip-hierarchy-viewport">
<input type="text" placeholder="Password ..." class="form-control" id="example-tooltip-hierarchy" />
</div>
</div>
</form>
</pre>
</div>
</td>
</tr>
<tr>
<th colspan="2"><code>progressBar</code> driver</th>
</tr>
<tr>
<td colspan="2">
<p>
The <code>progressBar</code> driver will visualize the password strength as progress bar.
</p>
<p>
A basic example is shown below.
</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-progress-bar').strengthMeter('progressBar', {
container: $('#example-progress-bar-container')
});
});
</script>
<form class="form-horizontal">
<div class="form-group">
<label class="form-label col-sm-2">Password</label>
<div class="col-sm-4">
<input type="text" placeholder="Password ..." class="form-control" id="example-progress-bar" />
</div>
</div>
<div class="form-group">
<label class="form-label col-sm-2">Password Strength</label>
<div class="col-sm-4" id="example-progress-bar-container">
</div>
</div>
</form>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
<script type="text/javascript">
$(document).ready(function() {
$('#example-progress-bar').strengthMeter('progressBar', {
container: $('#example-progress-bar-container')
});
});
</script>
<form class="form-horizontal">
<div class="form-group">
<label class="form-label col-sm-2">Password</label>
<div class="col-sm-4">
<input type="text" placeholder="Password ..." class="form-control" id="example-progress-bar" />
</div>
</div>
<div class="form-group">
<label class="form-label col-sm-2">Password Strength</label>
<div class="col-sm-4" id="example-progress-bar-container">
</div>
</div>
</form>
</pre>
</div>
</td>
</tr>
<tr>
<td><code>container</code></td>
<td>
<p>
The container element the progress bar is appended to.
</p>
<p>
An example can be found above.
</p>
</td>
</tr>
<tr>
<td><code>hierarchy</code></td>
<td>
<p>
This option allows to control the color of the progress bar. The default option looks as follows:
</p>
<pre class="prettyprint linenums">
hierarchy: {
'0': 'progress-bar-danger',
'50': 'progress-bar-warning',
'100': 'progress-bar-success'
}
</pre>
<p>
The keys refer to the score needed in order to change the color of the pgroess bar. This means that a password with a score between 0 and 25 is depicted as red (<code>progress-bar-danger</code>). For this purpose it is useful to understand what the score means: A score of $h$ means that a maximum of $2^h$ attempts are necessary to crack the password. The higher $h$ the stronger the password.
</p>
<p>
An example is given below:
</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-progress-bar-hierarchy').strengthMeter('progressBar', {
container: $('#example-progress-bar-hierarchy-container'),
hierarchy: {
'0': 'progress-bar-danger',
'25': 'progress-bar-warning',
'200': 'progress-bar-success'
}
});
});
</script>
<form class="form-horizontal">
<div class="form-group">
<label class="form-label col-sm-2">Password</label>
<div class="col-sm-4">
<input type="text" placeholder="Password ..." class="form-control" id="example-progress-bar-hierarchy" />
</div>
</div>
<div class="form-group">
<label class="form-label col-sm-2">Password Strength</label>
<div class="col-sm-4" id="example-progress-bar-hierarchy-container">
</div>
</div>
</form>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
<script type="text/javascript">
$(document).ready(function() {
$('#example-progress-bar-hierarchy').strengthMeter('progressBar', {
container: $('#example-progress-bar-hierarchy-container'),
hierarchy: {
'0': 'progress-bar-danger',
'25': 'progress-bar-warning',
'200': 'progress-bar-success'
}
});
});
</script>
<form class="form-horizontal">
<div class="form-group">
<label class="form-label col-sm-2">Password</label>
<div class="col-sm-4">
<input type="text" placeholder="Password ..." class="form-control" id="example-progress-bar-hierarchy" />
</div>
</div>
<div class="form-group">
<label class="form-label col-sm-2">Password Strength</label>
<div class="col-sm-4" id="example-progress-bar-hierarchy-container">
</div>
</div>
</form>
</pre>
</div>
</td>
</tr>
</tbody>
</table>
<div class="page-header">
<h2 id="license">License</h2>
</div>
<dl>
<dt>BSD 3-Clause License</dt>
<dd>
<p>Copyright (c) 2013 - 2018 David Stutz</p>
<p>All rights reserved.</p>
<p>
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
</p>
<ul>
<li>Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
<li>Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
<li>Neither the name of David Stutz nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
</ul>
<p>
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</p>
</dd>
</dl>
<hr>
<p>
© 2013 - 2020
<a target="_blank" href="http://davidstutz.de">David Stutz</a> — <a target="_blank" href="http://opensource.org/licenses/BSD-3-Clause">BSD 3-Clause License</a> — <a href="https://davidstutz.de/impressum/">Impressum</a> — <a href="https://davidstutz.de/datenschutz/">Datenschutz</a>
</p>
</div>
</div>
</div>
</body>
</html>