Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js index e534435..5fd10f9 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.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.Controllers'); | 26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Controllers'); |
30 | 27 | ||
31 | Clipperz.PM.UI.Common.Controllers.DirectLoginRunner = function(args) { | 28 | Clipperz.PM.UI.Common.Controllers.DirectLoginRunner = function(args) { |
32 | this._directLogin = args['directLogin'] || Clipperz.Base.exception.raise('MandatoryParameter'); | 29 | this._directLogin = args['directLogin'] || Clipperz.Base.exception.raise('MandatoryParameter'); |
33 | this._target = Clipperz.PM.Crypto.randomKey(); | 30 | this._target = Clipperz.PM.Crypto.randomKey(); |
34 | 31 | ||
35 | return this; | 32 | return this; |
36 | } | 33 | } |
37 | 34 | ||
38 | MochiKit.Base.update(Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.prototype, { | 35 | MochiKit.Base.update(Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.prototype, { |
39 | 36 | ||
40 | 'toString': function() { | 37 | 'toString': function() { |
41 | return "Clipperz.PM.UI.Common.Controllers.DirectLoginRunner"; | 38 | return "Clipperz.PM.UI.Common.Controllers.DirectLoginRunner"; |
42 | }, | 39 | }, |
43 | 40 | ||
44 | //----------------------------------------------------------------------------- | 41 | //----------------------------------------------------------------------------- |
45 | 42 | ||
46 | 'directLogin': function () { | 43 | 'directLogin': function () { |
47 | return this._directLogin; | 44 | return this._directLogin; |
48 | }, | 45 | }, |
49 | 46 | ||
50 | //----------------------------------------------------------------------------- | 47 | //----------------------------------------------------------------------------- |
51 | 48 | ||
52 | 'target': function () { | 49 | 'target': function () { |
53 | return this._target; | 50 | return this._target; |
54 | }, | 51 | }, |
55 | 52 | ||
56 | //============================================================================= | 53 | //============================================================================= |
57 | 54 | ||
58 | 'setWindowTitle': function (aWindow, aTitle) { | 55 | 'setWindowTitle': function (aWindow, aTitle) { |
59 | aWindow.document.title = aTitle; | 56 | aWindow.document.title = aTitle; |
60 | }, | 57 | }, |
61 | 58 | ||
62 | 'setWindowBody': function (aWindow, anHTML) { | 59 | 'setWindowBody': function (aWindow, anHTML) { |
63 | aWindow.document.body.innerHTML = anHTML; | 60 | aWindow.document.body.innerHTML = anHTML; |
64 | }, | 61 | }, |
65 | 62 | ||
66 | //============================================================================= | 63 | //============================================================================= |
67 | 64 | ||
68 | 'initialWindowSetup': function (aWindow) { | 65 | 'initialWindowSetup': function (aWindow) { |
69 | this.setWindowTitle(aWindow, "Loading Clipperz Direct Login"); | 66 | this.setWindowTitle(aWindow, "Loading Clipperz Direct Login"); |
70 | this.setWindowBody (aWindow, MochiKit.DOM.toHTML(MochiKit.DOM.H3("Loading Clipperz Direct Login ..."))); | 67 | this.setWindowBody (aWindow, MochiKit.DOM.toHTML(MochiKit.DOM.H3("Loading Clipperz Direct Login ..."))); |
71 | }, | 68 | }, |
72 | 69 | ||
73 | //----------------------------------------------------------------------------- | 70 | //----------------------------------------------------------------------------- |
74 | 71 | ||
75 | 'updateWindowWithDirectLoginLabel': function (aWindow, aLabel) { | 72 | 'updateWindowWithDirectLoginLabel': function (aWindow, aLabel) { |
76 | var titleText; | 73 | var titleText; |
77 | var bodyText; | 74 | var bodyText; |
78 | 75 | ||
79 | titleText = "Loading '__label__' Direct Login".replace(/__label__/, aLabel) | 76 | titleText = "Loading '__label__' Direct Login".replace(/__label__/, aLabel) |
80 | bodyText = "Loading '__label__' Direct Login... ".replace(/__label__/, aLabel) | 77 | bodyText = "Loading '__label__' Direct Login... ".replace(/__label__/, aLabel) |
81 | 78 | ||
82 | this.setWindowTitle(aWindow, titleText); | 79 | this.setWindowTitle(aWindow, titleText); |
83 | this.setWindowBody (aWindow, MochiKit.DOM.toHTML(MochiKit.DOM.H3(bodyText))); | 80 | this.setWindowBody (aWindow, MochiKit.DOM.toHTML(MochiKit.DOM.H3(bodyText))); |
84 | }, | 81 | }, |
85 | 82 | ||
86 | //----------------------------------------------------------------------------- | 83 | //----------------------------------------------------------------------------- |
87 | 84 | ||
88 | 'updateWindowWithHTMLContent': function (aWindow, anHtml) { | 85 | 'updateWindowWithHTMLContent': function (aWindow, anHtml) { |
89 | this.setWindowBody(aWindow, anHtml); | 86 | this.setWindowBody(aWindow, anHtml); |
90 | }, | 87 | }, |
91 | 88 | ||
92 | //============================================================================= | 89 | //============================================================================= |
93 | 90 | ||
94 | 'submitLoginForm': function(aWindow, aSubmitFunction) { | 91 | 'submitLoginForm': function(aWindow, aSubmitFunction) { |
95 | MochiKit.DOM.withWindow(aWindow, MochiKit.Base.bind(function () { | 92 | MochiKit.DOM.withWindow(aWindow, MochiKit.Base.bind(function () { |
96 | var formElement; | 93 | var formElement; |
97 | var submitButtons; | 94 | var submitButtons; |
98 | 95 | ||
99 | formElement = MochiKit.DOM.getElement('directLoginForm'); | 96 | formElement = MochiKit.DOM.getElement('directLoginForm'); |
100 | 97 | ||
101 | submitButtons = MochiKit.Base.filter(function(anInputElement) { | 98 | submitButtons = MochiKit.Base.filter(function(anInputElement) { |
102 | return ((anInputElement.tagName.toLowerCase() == 'input') && (anInputElement.getAttribute('type').toLowerCase() == 'submit')); | 99 | return ((anInputElement.tagName.toLowerCase() == 'input') && (anInputElement.getAttribute('type').toLowerCase() == 'submit')); |
103 | }, formElement.elements); | 100 | }, formElement.elements); |
104 | 101 | ||
105 | if (submitButtons.length == 0) { | 102 | if (submitButtons.length == 0) { |
106 | if (typeof(formElement.submit) == 'function') { | 103 | if (typeof(formElement.submit) == 'function') { |
107 | formElement.submit(); | 104 | formElement.submit(); |
108 | } else { | 105 | } else { |
109 | aSubmitFunction.apply(formElement); | 106 | aSubmitFunction.apply(formElement); |
110 | } | 107 | } |
111 | /* | 108 | /* |
112 | varformSubmitFunction; | 109 | varformSubmitFunction; |
113 | 110 | ||
114 | formSubmitFunction = MochiKit.Base.method(formElement, 'submit'); | 111 | formSubmitFunction = MochiKit.Base.method(formElement, 'submit'); |
115 | if (Clipperz_IEisBroken == true) { | 112 | if (Clipperz_IEisBroken == true) { |
116 | formElement.submit(); | 113 | formElement.submit(); |
117 | } else { | 114 | } else { |
118 | formSubmitFunction(); | 115 | formSubmitFunction(); |
119 | } | 116 | } |
120 | */ | 117 | */ |