summaryrefslogtreecommitdiff
path: root/frontend/beta/js/Clipperz/PM/Components/PasswordGenerator.js
Unidiff
Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/PasswordGenerator.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/PasswordGenerator.js22
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Components/PasswordGenerator.js b/frontend/beta/js/Clipperz/PM/Components/PasswordGenerator.js
index 87c52b2..67db50a 100644
--- a/frontend/beta/js/Clipperz/PM/Components/PasswordGenerator.js
+++ b/frontend/beta/js/Clipperz/PM/Components/PasswordGenerator.js
@@ -1,150 +1,148 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 24if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 25if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
28if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } 26if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
29 27
30Clipperz.PM.Components.PasswordGenerator = function(anElement, aFieldValueComponent, args) { 28Clipperz.PM.Components.PasswordGenerator = function(anElement, aFieldValueComponent, args) {
31 args = args || {}; 29 args = args || {};
32 30
33//MochiKit.Logging.logDebug(">>> new TextFormField"); 31//MochiKit.Logging.logDebug(">>> new TextFormField");
34 Clipperz.PM.Components.PasswordGenerator.superclass.constructor.call(this, anElement, args); 32 Clipperz.PM.Components.PasswordGenerator.superclass.constructor.call(this, anElement, args);
35 33
36 this._fieldValueComponent = aFieldValueComponent; 34 this._fieldValueComponent = aFieldValueComponent;
37 this._panelButton = null; 35 this._panelButton = null;
38 this.render(); 36 this.render();
39//MochiKit.Logging.logDebug("<<< new TextFormField"); 37//MochiKit.Logging.logDebug("<<< new TextFormField");
40 38
41 return this; 39 return this;
42}; 40};
43 41
44YAHOO.extendX(Clipperz.PM.Components.PasswordGenerator, Clipperz.PM.Components.BaseComponent, { 42YAHOO.extendX(Clipperz.PM.Components.PasswordGenerator, Clipperz.PM.Components.BaseComponent, {
45 43
46 'toString': function() { 44 'toString': function() {
47 return "Clipperz.PM.Components.PasswordGenerator"; 45 return "Clipperz.PM.Components.PasswordGenerator";
48 }, 46 },
49 47
50 //----------------------------------------------------- 48 //-----------------------------------------------------
51 49
52 'fieldValueComponent': function() { 50 'fieldValueComponent': function() {
53 return this._fieldValueComponent; 51 return this._fieldValueComponent;
54 }, 52 },
55 53
56 //----------------------------------------------------- 54 //-----------------------------------------------------
57 55
58 'render': function() { 56 'render': function() {
59 MochiKit.Signal.disconnectAllTo(this); 57 MochiKit.Signal.disconnectAllTo(this);
60 58
61 // this._panelButton = new YAHOO.ext.Button(this.element().dom, {text:Clipperz.PM.Strings['passwordGeneratorButtonLabel'], handler:this.openPasswordPanel, scope:this}); 59 // this._panelButton = new YAHOO.ext.Button(this.element().dom, {text:Clipperz.PM.Strings['passwordGeneratorButtonLabel'], handler:this.openPasswordPanel, scope:this});
62 MochiKit.Signal.connect(this.element().dom, 'onmouseenter', this, 'onMouseEnter'); 60 MochiKit.Signal.connect(this.element().dom, 'onmouseenter', this, 'onMouseEnter');
63 MochiKit.Signal.connect(this.element().dom, 'onmouseleave', this, 'onMouseLeave'); 61 MochiKit.Signal.connect(this.element().dom, 'onmouseleave', this, 'onMouseLeave');
64 MochiKit.Signal.connect(this.element().dom, 'onclick', this, 'openPasswordPanel'); 62 MochiKit.Signal.connect(this.element().dom, 'onclick', this, 'openPasswordPanel');
65 }, 63 },
66 64
67 //----------------------------------------------------- 65 //-----------------------------------------------------
68 66
69 'onMouseEnter': function() { 67 'onMouseEnter': function() {
70 this.element().addClass('hover'); 68 this.element().addClass('hover');
71 }, 69 },
72 70
73 'onMouseLeave': function() { 71 'onMouseLeave': function() {
74 this.element().removeClass('hover'); 72 this.element().removeClass('hover');
75 }, 73 },
76 74
77 //----------------------------------------------------- 75 //-----------------------------------------------------
78 76
79 'panelButton': function() { 77 'panelButton': function() {
80 return this._panelButton; 78 return this._panelButton;
81 }, 79 },
82 80
83 //----------------------------------------------------- 81 //-----------------------------------------------------
84 82
85 'openPasswordPanel': function() { 83 'openPasswordPanel': function() {
86 var passwordGeneratorElement; 84 var passwordGeneratorElement;
87 var passwordGeneratorDialog; 85 var passwordGeneratorDialog;
88 var cancelButton; 86 var cancelButton;
89 var okButton; 87 var okButton;
90 var cancelFunction; 88 var cancelFunction;
91 var okFunction; 89 var okFunction;
92 90
93//MochiKit.Logging.logDebug(">>> PasswordGenerator.openPasswordPanel"); 91//MochiKit.Logging.logDebug(">>> PasswordGenerator.openPasswordPanel");
94 passwordGeneratorElement = Clipperz.YUI.DomHelper.append(document.body, {tag:'div', id:'passwordGenerator', children:[ 92 passwordGeneratorElement = Clipperz.YUI.DomHelper.append(document.body, {tag:'div', id:'passwordGenerator', children:[
95 {tag:'div', cls:'ydlg-hd', htmlString:Clipperz.PM.Strings['passwordGeneratorPanelTitle']}, 93 {tag:'div', cls:'ydlg-hd', htmlString:Clipperz.PM.Strings['passwordGeneratorPanelTitle']},
96 {tag:'div', cls:'ydlg-bd', children:[ 94 {tag:'div', cls:'ydlg-bd', children:[
97 {tag:'form', id:this.getId('passwordGeneratorForm'), cls:'passwordGenerator', children:[ 95 {tag:'form', id:this.getId('passwordGeneratorForm'), cls:'passwordGenerator', children:[
98 {tag:'input', type:'text', cls:'clipperz_passwordGenerator_password', id:this.getId('passwordField')}, 96 {tag:'input', type:'text', cls:'clipperz_passwordGenerator_password', id:this.getId('passwordField')},
99 {tag:'table', children:[ 97 {tag:'table', children:[
100 {tag:'tbody', children:[ 98 {tag:'tbody', children:[
101 {tag:'tr', children:[ 99 {tag:'tr', children:[
102 {tag:'td', width:'20%', children:[ 100 {tag:'td', width:'20%', children:[
103 {tag:'input', type:'checkbox', name:'lowercase', id:this.getId('lowercase'), checked:true}, 101 {tag:'input', type:'checkbox', name:'lowercase', id:this.getId('lowercase'), checked:true},
104 {tag:'span', htmlString:Clipperz.PM.Strings['passwordGeneratorLowercaseLabel']} 102 {tag:'span', htmlString:Clipperz.PM.Strings['passwordGeneratorLowercaseLabel']}
105 ]}, 103 ]},
106 {tag:'td', width:'20%', children:[ 104 {tag:'td', width:'20%', children:[
107 {tag:'input', type:'checkbox', name:'uppercase', id:this.getId('uppercase'), checked:true}, 105 {tag:'input', type:'checkbox', name:'uppercase', id:this.getId('uppercase'), checked:true},
108 {tag:'span', htmlString:Clipperz.PM.Strings['passwordGeneratorUppercaseLabel']} 106 {tag:'span', htmlString:Clipperz.PM.Strings['passwordGeneratorUppercaseLabel']}
109 ]}, 107 ]},
110 {tag:'td', width:'20%', children:[ 108 {tag:'td', width:'20%', children:[
111 {tag:'input', type:'checkbox', name:'numbers', id:this.getId('numbers'), checked:true}, 109 {tag:'input', type:'checkbox', name:'numbers', id:this.getId('numbers'), checked:true},
112 {tag:'span', htmlString:Clipperz.PM.Strings['passwordGeneratorNumberLabel']} 110 {tag:'span', htmlString:Clipperz.PM.Strings['passwordGeneratorNumberLabel']}
113 ]}, 111 ]},
114 {tag:'td', width:'20%', children:[ 112 {tag:'td', width:'20%', children:[
115 {tag:'input', type:'checkbox', name:'symbols', id:this.getId('symbols'), checked:true}, 113 {tag:'input', type:'checkbox', name:'symbols', id:this.getId('symbols'), checked:true},
116 {tag:'span', htmlString:Clipperz.PM.Strings['passwordGeneratorSymbolLabel']} 114 {tag:'span', htmlString:Clipperz.PM.Strings['passwordGeneratorSymbolLabel']}
117 ]}, 115 ]},
118 {tag:'td', width:'20%', children:[ 116 {tag:'td', width:'20%', children:[
119 {tag:'span', cls:'passwordGeneratorLength', children:[ 117 {tag:'span', cls:'passwordGeneratorLength', children:[
120 {tag:'span', htmlString:Clipperz.PM.Strings['passwordGeneratorLengthLabel']}, 118 {tag:'span', htmlString:Clipperz.PM.Strings['passwordGeneratorLengthLabel']},
121 {tag:'span', id:this.getId('passwordLength'), cls:'passwordGeneratorLengthValue', html:'0'} 119 {tag:'span', id:this.getId('passwordLength'), cls:'passwordGeneratorLengthValue', html:'0'}
122 ]} 120 ]}
123 ]} 121 ]}
124 ]} 122 ]}
125 ]} 123 ]}
126 ]} 124 ]}
127 ]} 125 ]}
128 ]}, 126 ]},
129 {tag:'div', cls:'ydlg-ft'} 127 {tag:'div', cls:'ydlg-ft'}
130 ]}, true); 128 ]}, true);
131 129
132 new Clipperz.PM.Components.PasswordEntropyDisplay(this.getElement('passwordField')); 130 new Clipperz.PM.Components.PasswordEntropyDisplay(this.getElement('passwordField'));
133 131
134 MochiKit.Signal.connect(this.getId('lowercase'), 'onclick', this, 'updatePasswordValue'); 132 MochiKit.Signal.connect(this.getId('lowercase'), 'onclick', this, 'updatePasswordValue');
135 MochiKit.Signal.connect(this.getId('uppercase'), 'onclick', this, 'updatePasswordValue'); 133 MochiKit.Signal.connect(this.getId('uppercase'), 'onclick', this, 'updatePasswordValue');
136 MochiKit.Signal.connect(this.getId('numbers'), 'onclick', this, 'updatePasswordValue'); 134 MochiKit.Signal.connect(this.getId('numbers'), 'onclick', this, 'updatePasswordValue');
137 MochiKit.Signal.connect(this.getId('symbols'), 'onclick', this, 'updatePasswordValue'); 135 MochiKit.Signal.connect(this.getId('symbols'), 'onclick', this, 'updatePasswordValue');
138 136
139 MochiKit.Signal.connect(this.getDom('passwordField'), 'onkeyup', this, 'updatePasswordLengthLabel'); 137 MochiKit.Signal.connect(this.getDom('passwordField'), 'onkeyup', this, 'updatePasswordLengthLabel');
140 MochiKit.Signal.connect(this.getDom('passwordField'), 'onchange', this, 'updatePasswordLengthLabel'); 138 MochiKit.Signal.connect(this.getDom('passwordField'), 'onchange', this, 'updatePasswordLengthLabel');
141 MochiKit.Signal.connect(this.getDom('passwordField'), 'onblur', this, 'updatePasswordLengthLabel'); 139 MochiKit.Signal.connect(this.getDom('passwordField'), 'onblur', this, 'updatePasswordLengthLabel');
142 140
143 this.updatePasswordValue(); 141 this.updatePasswordValue();
144 142
145 passwordGeneratorDialog = new YAHOO.ext.BasicDialog( 143 passwordGeneratorDialog = new YAHOO.ext.BasicDialog(
146 passwordGeneratorElement, { 144 passwordGeneratorElement, {
147 autoCreate:false, 145 autoCreate:false,
148 closable:false, 146 closable:false,
149 modal:true, 147 modal:true,
150 autoTabs:false, 148 autoTabs:false,