Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js') (more/less context) (show whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js index c1b4f13..089e3d4 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js | |||
@@ -1,120 +1,117 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz's Javascript Crypto Library. | 5 | This file is part of Clipperz Community Edition. |
6 | Javascript Crypto Library provides web developers with an extensive | 6 | Clipperz Community Edition is an online password manager. |
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
11 | refer to http://www.clipperz.com | 8 | refer to http://www.clipperz.com. |
12 | 9 | ||
13 | * Javascript Crypto Library is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
14 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
15 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
16 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
17 | 14 | ||
18 | * Javascript Crypto Library is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
21 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
22 | 19 | ||
23 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
24 | License along with Javascript Crypto Library. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
25 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
26 | 23 | ||
27 | */ | 24 | */ |
28 | 25 | ||
29 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
30 | 27 | ||
31 | Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay = function(anElement, args) { | 28 | Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay = function(anElement, args) { |
32 | args = args || {}; | 29 | args = args || {}; |
33 | 30 | ||
34 | //MochiKit.Logging.logDebug(">>> new TextFormField"); | 31 | //MochiKit.Logging.logDebug(">>> new TextFormField"); |
35 | Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay.superclass.constructor.call(this, anElement, args); | 32 | Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay.superclass.constructor.call(this, anElement, args); |
36 | 33 | ||
37 | this._wrapperElement = null; | 34 | this._wrapperElement = null; |
38 | this._entropyElement = null; | 35 | this._entropyElement = null; |
39 | 36 | ||
40 | this.render(); | 37 | this.render(); |
41 | //MochiKit.Logging.logDebug("<<< new TextFormField"); | 38 | //MochiKit.Logging.logDebug("<<< new TextFormField"); |
42 | 39 | ||
43 | return this; | 40 | return this; |
44 | }; | 41 | }; |
45 | 42 | ||
46 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay, Clipperz.PM.UI.Common.Components.BaseComponent, { | 43 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay, Clipperz.PM.UI.Common.Components.BaseComponent, { |
47 | 44 | ||
48 | 'toString': function() { | 45 | 'toString': function() { |
49 | return "Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay"; | 46 | return "Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay"; |
50 | }, | 47 | }, |
51 | 48 | ||
52 | //----------------------------------------------------- | 49 | //----------------------------------------------------- |
53 | 50 | ||
54 | 'wrapperElement': function() { | 51 | 'wrapperElement': function() { |
55 | return this._wrapperElement; | 52 | return this._wrapperElement; |
56 | }, | 53 | }, |
57 | 54 | ||
58 | 'setWrapperElement': function(aValue) { | 55 | 'setWrapperElement': function(aValue) { |
59 | this._wrapperElement = aValue; | 56 | this._wrapperElement = aValue; |
60 | }, | 57 | }, |
61 | 58 | ||
62 | //----------------------------------------------------- | 59 | //----------------------------------------------------- |
63 | 60 | ||
64 | 'passwordElement': function() { | 61 | 'passwordElement': function() { |
65 | return this.element(); | 62 | return this.element(); |
66 | }, | 63 | }, |
67 | 64 | ||
68 | //----------------------------------------------------- | 65 | //----------------------------------------------------- |
69 | 66 | ||
70 | 'entropyElement': function() { | 67 | 'entropyElement': function() { |
71 | return this._entropyElement; | 68 | return this._entropyElement; |
72 | }, | 69 | }, |
73 | 70 | ||
74 | 'setEntropyElement': function(aValue) { | 71 | 'setEntropyElement': function(aValue) { |
75 | this._entropyElement = aValue; | 72 | this._entropyElement = aValue; |
76 | }, | 73 | }, |
77 | 74 | ||
78 | //----------------------------------------------------- | 75 | //----------------------------------------------------- |
79 | 76 | ||
80 | 'render': function() { | 77 | 'render': function() { |
81 | /* | 78 | /* |
82 | MochiKit.Signal.disconnectAllTo(this); | 79 | MochiKit.Signal.disconnectAllTo(this); |
83 | 80 | ||
84 | this.setWrapperElement(this.element().wrap({tag:'div'})); | 81 | this.setWrapperElement(this.element().wrap({tag:'div'})); |
85 | this.setEntropyElement(Clipperz.DOM.Helper.append(this.wrapperElement().dom, {tag:'div', cls:'passwordEntropy', html:" "}, true)); | 82 | this.setEntropyElement(Clipperz.DOM.Helper.append(this.wrapperElement().dom, {tag:'div', cls:'passwordEntropy', html:" "}, true)); |
86 | // this.setEntropyElement(Clipperz.DOM.Helper.insertBefore(this.element(), {tag:'div', cls:'passwordEntropy', html:" "}, true)); | 83 | // this.setEntropyElement(Clipperz.DOM.Helper.insertBefore(this.element(), {tag:'div', cls:'passwordEntropy', html:" "}, true)); |
87 | this.entropyElement().wrap({tag:'div', cls:'passwordEntropyWrapper'}); | 84 | this.entropyElement().wrap({tag:'div', cls:'passwordEntropyWrapper'}); |
88 | 85 | ||
89 | this.updateEntropyElement(); | 86 | this.updateEntropyElement(); |
90 | 87 | ||
91 | this.connect('onkeyup', 'updateEntropyElement'); | 88 | this.connect('onkeyup', 'updateEntropyElement'); |
92 | this.connect('onchange', 'updateEntropyElement'); | 89 | this.connect('onchange', 'updateEntropyElement'); |
93 | this.connect('onblur', 'updateEntropyElement'); | 90 | this.connect('onblur', 'updateEntropyElement'); |
94 | */ | 91 | */ |
95 | MochiKit.Signal.disconnectAllTo(this); | 92 | MochiKit.Signal.disconnectAllTo(this); |
96 | 93 | ||
97 | this.setEntropyElement(this.element()); | 94 | this.setEntropyElement(this.element()); |
98 | this.entropyElement().addClass("entropyLevelIndicator"); | 95 | this.entropyElement().addClass("entropyLevelIndicator"); |
99 | 96 | ||
100 | this.updateEntropyElement(); | 97 | this.updateEntropyElement(); |
101 | 98 | ||
102 | this.connect('onkeyup', 'updateEntropyElement'); | 99 | this.connect('onkeyup', 'updateEntropyElement'); |
103 | this.connect('onchange', 'updateEntropyElement'); | 100 | this.connect('onchange', 'updateEntropyElement'); |
104 | this.connect('onblur', 'updateEntropyElement'); | 101 | this.connect('onblur', 'updateEntropyElement'); |
105 | }, | 102 | }, |
106 | 103 | ||
107 | //----------------------------------------------------- | 104 | //----------------------------------------------------- |
108 | 105 | ||
109 | 'computeEntropyForString': function(aValue) { | 106 | 'computeEntropyForString': function(aValue) { |
110 | return Clipperz.PM.Crypto.passwordEntropy(aValue); | 107 | return Clipperz.PM.Crypto.passwordEntropy(aValue); |
111 | }, | 108 | }, |
112 | 109 | ||
113 | //----------------------------------------------------- | 110 | //----------------------------------------------------- |
114 | 111 | ||
115 | 'updateEntropyElement': function(anEvent) { | 112 | 'updateEntropyElement': function(anEvent) { |
116 | /* | 113 | /* |
117 | //MochiKit.Logging.logDebug(">>> PasswordEntropyDisplay.updateEntropyElement"); | 114 | //MochiKit.Logging.logDebug(">>> PasswordEntropyDisplay.updateEntropyElement"); |
118 | varmaxExtent; | 115 | varmaxExtent; |
119 | varentropy; | 116 | varentropy; |
120 | 117 | ||