summaryrefslogtreecommitdiff
path: root/frontend/beta/js/Clipperz/PM/Components/Compact/LoginForm.js
Unidiff
Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/Compact/LoginForm.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Compact/LoginForm.js15
1 files changed, 6 insertions, 9 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Components/Compact/LoginForm.js b/frontend/beta/js/Clipperz/PM/Components/Compact/LoginForm.js
index d708464..a1e60d8 100644
--- a/frontend/beta/js/Clipperz/PM/Components/Compact/LoginForm.js
+++ b/frontend/beta/js/Clipperz/PM/Components/Compact/LoginForm.js
@@ -1,120 +1,117 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer 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
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } 28if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.Compact) == 'undefined') { Clipperz.PM.Components.Compact = {}; } 29if (typeof(Clipperz.PM.Components.Compact) == 'undefined') { Clipperz.PM.Components.Compact = {}; }
33 30
34Clipperz.PM.Components.Compact.LoginForm = function(anElement, args) { 31Clipperz.PM.Components.Compact.LoginForm = function(anElement, args) {
35 32
36 Clipperz.PM.Components.Compact.LoginForm.superclass.constructor.call(this, anElement, args); 33 Clipperz.PM.Components.Compact.LoginForm.superclass.constructor.call(this, anElement, args);
37 34
38 this.render(); 35 this.render();
39 Clipperz.NotificationCenter.register(null, 'updatedProgressState', this, 'userNotificationHandler') 36 Clipperz.NotificationCenter.register(null, 'updatedProgressState', this, 'userNotificationHandler')
40 37
41 return this; 38 return this;
42}; 39};
43 40
44YAHOO.extendX(Clipperz.PM.Components.Compact.LoginForm, Clipperz.PM.Components.BaseComponent, { 41YAHOO.extendX(Clipperz.PM.Components.Compact.LoginForm, Clipperz.PM.Components.BaseComponent, {
45 42
46 'toString': function() { 43 'toString': function() {
47 return "Clipperz.PM.Components.Compact.LoginForm"; 44 return "Clipperz.PM.Components.Compact.LoginForm";
48 }, 45 },
49 46
50 //----------------------------------------------------- 47 //-----------------------------------------------------
51 48
52 'render': function() { 49 'render': function() {
53 var result; 50 var result;
54 varlayout; 51 varlayout;
55 52
56 MochiKit.Signal.disconnectAllTo(this); 53 MochiKit.Signal.disconnectAllTo(this);
57 this.element().update(""); 54 this.element().update("");
58 55
59 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', id:this.getId('baseDiv'), cls:'LoginPanel', children:[ 56 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', id:this.getId('baseDiv'), cls:'LoginPanel', children:[
60 {tag:'div', id:'compactHeader'}, 57 {tag:'div', id:'compactHeader'},
61 {tag:'div', id:'compactBody', children:[ 58 {tag:'div', id:'compactBody', children:[
62 {tag:'form', id:this.getId('loginForm_form'), children:[ 59 {tag:'form', id:this.getId('loginForm_form'), children:[
63 {tag:'dl', children:[ 60 {tag:'dl', children:[
64 {tag:'dt', htmlString:Clipperz.PM.Strings['loginFormUsernameLabel']}, 61 {tag:'dt', htmlString:Clipperz.PM.Strings['loginFormUsernameLabel']},
65 {tag:'dd', children:[ 62 {tag:'dd', children:[
66 {tag:'input', id:this.getId('login_username'), type:'text', size:'30', name:'username'} 63 {tag:'input', id:this.getId('login_username'), type:'text', size:'30', name:'username'}
67 ]}, 64 ]},
68 {tag:'dt', htmlString:Clipperz.PM.Strings['loginFormPassphraseLabel']}, 65 {tag:'dt', htmlString:Clipperz.PM.Strings['loginFormPassphraseLabel']},
69 {tag:'dd', children:[ 66 {tag:'dd', children:[
70 {tag:'input', id:this.getId('login_passphrase'), type:'password', size:'30', name:'passphrase'} 67 {tag:'input', id:this.getId('login_passphrase'), type:'password', size:'30', name:'passphrase'}
71 ]} 68 ]}
72 ]}, 69 ]},
73 {tag:'div', id:this.getId('login_submit')} 70 {tag:'div', id:this.getId('login_submit')}
74 ]}, 71 ]},
75 {tag:'h4', id:this.getId('message')} 72 {tag:'h4', id:this.getId('message')}
76 ]} 73 ]}
77 ]}); 74 ]});
78 75
79 new Clipperz.PM.Components.Compact.CompactHeader(YAHOO.ext.Element.get('compactHeader')); 76 new Clipperz.PM.Components.Compact.CompactHeader(YAHOO.ext.Element.get('compactHeader'));
80 77
81 MochiKit.Signal.connect(this.getId('loginForm_form'), 'onsubmit', this, 'stopFormSubmit'); 78 MochiKit.Signal.connect(this.getId('loginForm_form'), 'onsubmit', this, 'stopFormSubmit');
82 new YAHOO.ext.Button(this.getId('login_submit'), {text:Clipperz.PM.Strings['loginFormButtonLabel'], handler:this.doLogin, scope:this, minWidth:0}); 79 new YAHOO.ext.Button(this.getId('login_submit'), {text:Clipperz.PM.Strings['loginFormButtonLabel'], handler:this.doLogin, scope:this, minWidth:0});
83 this.getElement('login_submit').swallowEvent('click', true); 80 this.getElement('login_submit').swallowEvent('click', true);
84 81
85 MochiKit.Signal.connect(this.getId('loginForm_form'), 'onkeydown', this, 'onkeydown'); 82 MochiKit.Signal.connect(this.getId('loginForm_form'), 'onkeydown', this, 'onkeydown');
86 83
87 new Clipperz.PM.Components.PasswordEntropyDisplay(this.getElement('login_passphrase')); 84 new Clipperz.PM.Components.PasswordEntropyDisplay(this.getElement('login_passphrase'));
88 this.getElement('login_username').focus(); 85 this.getElement('login_username').focus();
89 86
90 return result; 87 return result;
91 }, 88 },
92 89
93 //----------------------------------------------------- 90 //-----------------------------------------------------
94 91
95 'doLogin': function(e) { 92 'doLogin': function(e) {
96//MochiKit.Logging.logDebug(">>> compact.LoginForm.doLogin"); 93//MochiKit.Logging.logDebug(">>> compact.LoginForm.doLogin");
97 if (this.checkLoginForm()) { 94 if (this.checkLoginForm()) {
98 this.doLoginWithUsernameAndPassphrase(this.getDom('login_username').value, this.getDom('login_passphrase').value); 95 this.doLoginWithUsernameAndPassphrase(this.getDom('login_username').value, this.getDom('login_passphrase').value);
99 } 96 }
100//MochiKit.Logging.logDebug("<<< compact.LoginForm.doLogin"); 97//MochiKit.Logging.logDebug("<<< compact.LoginForm.doLogin");
101 }, 98 },
102 99
103 //......................................................................... 100 //.........................................................................
104 101
105 'doLoginWithUsernameAndPassphrase': function(anUsername, aPassphrase) { 102 'doLoginWithUsernameAndPassphrase': function(anUsername, aPassphrase) {
106 var deferredResult; 103 var deferredResult;
107 var user; 104 var user;
108 105
109//MochiKit.Logging.logDebug(">>> compact.LoginForm.doLoginWithUsernameAndPassphrase"); 106//MochiKit.Logging.logDebug(">>> compact.LoginForm.doLoginWithUsernameAndPassphrase");
110 user = new Clipperz.PM.DataModel.User({username:anUsername, passphrase:aPassphrase}); 107 user = new Clipperz.PM.DataModel.User({username:anUsername, passphrase:aPassphrase});
111 108
112 deferredResult = new MochiKit.Async.Deferred(); 109 deferredResult = new MochiKit.Async.Deferred();
113 deferredResult.addCallback(MochiKit.Base.method(user, 'connect')); 110 deferredResult.addCallback(MochiKit.Base.method(user, 'connect'));
114 deferredResult.addCallback(MochiKit.Base.method(user, 'loadPreferences')); 111 deferredResult.addCallback(MochiKit.Base.method(user, 'loadPreferences'));
115 deferredResult.addCallback(MochiKit.Base.method(user, 'loadRecords')); 112 deferredResult.addCallback(MochiKit.Base.method(user, 'loadRecords'));
116 deferredResult.addCallback(MochiKit.Base.method(user, 'loadDirectLogins')); 113 deferredResult.addCallback(MochiKit.Base.method(user, 'loadDirectLogins'));
117 deferredResult.addErrback(MochiKit.Base.bind(function() { 114 deferredResult.addErrback(MochiKit.Base.bind(function() {
118 this.getElement('loginForm_form').setVisibilityMode(YAHOO.ext.Element.DISPLAY).show(); 115 this.getElement('loginForm_form').setVisibilityMode(YAHOO.ext.Element.DISPLAY).show();
119 this.getElement('message').update(Clipperz.PM.Strings['loginMessagePanelFailureText']); 116 this.getElement('message').update(Clipperz.PM.Strings['loginMessagePanelFailureText']);
120 this.getDom('login_passphrase').value = ""; 117 this.getDom('login_passphrase').value = "";