Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js index a10ba4f..38a9421 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js | |||
@@ -1,118 +1,116 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer 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 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.LoginForm = function(args) { | 26 | Clipperz.PM.UI.Web.Components.LoginForm = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | this._autocomplete = args.autocomplete || 'off'; | 29 | this._autocomplete = args.autocomplete || 'off'; |
32 | 30 | ||
33 | Clipperz.PM.UI.Web.Components.LoginForm.superclass.constructor.apply(this, arguments); | 31 | Clipperz.PM.UI.Web.Components.LoginForm.superclass.constructor.apply(this, arguments); |
34 | 32 | ||
35 | this._slots = { | 33 | this._slots = { |
36 | 'passphraseEntropy':this.getId('passphraseEntropy') | 34 | 'passphraseEntropy':this.getId('passphraseEntropy') |
37 | }; | 35 | }; |
38 | 36 | ||
39 | return this; | 37 | return this; |
40 | } | 38 | } |
41 | 39 | ||
42 | //============================================================================= | 40 | //============================================================================= |
43 | 41 | ||
44 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.LoginForm, Clipperz.PM.UI.Common.Components.BaseComponent, { | 42 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.LoginForm, Clipperz.PM.UI.Common.Components.BaseComponent, { |
45 | 43 | ||
46 | //------------------------------------------------------------------------- | 44 | //------------------------------------------------------------------------- |
47 | 45 | ||
48 | 'toString': function () { | 46 | 'toString': function () { |
49 | return "Clipperz.PM.UI.Web.Components.LoginForm component"; | 47 | return "Clipperz.PM.UI.Web.Components.LoginForm component"; |
50 | }, | 48 | }, |
51 | 49 | ||
52 | 'autocomplete': function () { | 50 | 'autocomplete': function () { |
53 | return this._autocomplete; | 51 | return this._autocomplete; |
54 | }, | 52 | }, |
55 | 53 | ||
56 | //------------------------------------------------------------------------- | 54 | //------------------------------------------------------------------------- |
57 | 55 | ||
58 | 'renderSelf': function() { | 56 | 'renderSelf': function() { |
59 | this.append(this.element(), {tag:'div', id:'loginBox', children:[ | 57 | this.append(this.element(), {tag:'div', id:'loginBox', children:[ |
60 | {tag:'div', cls:'header'}, | 58 | {tag:'div', cls:'header'}, |
61 | {tag:'div', cls:'body', id:this.getId('body'), children:[ | 59 | {tag:'div', cls:'body', id:this.getId('body'), children:[ |
62 | {tag:'div', id:this.getId('loginForm'), children:[ | 60 | {tag:'div', id:this.getId('loginForm'), children:[ |
63 | {tag:'div', children:[ | 61 | {tag:'div', children:[ |
64 | {tag:'h4', html:'Login'}, | 62 | {tag:'h4', html:'Login'}, |
65 | // {tag:'form', cls:'loginForm', autocomplete:this.autocomplete(), children:[ | 63 | // {tag:'form', cls:'loginForm', autocomplete:this.autocomplete(), children:[ |
66 | {tag:'form', id:this.getId('form'), cls:'loginForm', children:[ | 64 | {tag:'form', id:this.getId('form'), cls:'loginForm', children:[ |
67 | {tag:'label', html:'username', 'for':this.getId('usernameField')}, | 65 | {tag:'label', html:'username', 'for':this.getId('usernameField')}, |
68 | {tag:'input', id:this.getId('usernameField'), type:'text', cls:'username'}, | 66 | {tag:'input', id:this.getId('usernameField'), type:'text', cls:'username'}, |
69 | {tag:'label', html:'passphrase / OTP', 'for':this.getId('passphraseField')}, | 67 | {tag:'label', html:'passphrase / OTP', 'for':this.getId('passphraseField')}, |
70 | {tag:'input', id:this.getId('passphraseField'), type:'password', cls:'password'}, | 68 | {tag:'input', id:this.getId('passphraseField'), type:'password', cls:'password'}, |
71 | 69 | ||
72 | {tag:'div', cls:'translations', children:[ | 70 | {tag:'div', cls:'translations', children:[ |
73 | {tag:'h4', html:'choose your language'}, | 71 | {tag:'h4', html:'choose your language'}, |
74 | {tag:'ul', children:[ | 72 | {tag:'ul', children:[ |
75 | {tag:'li', cls:'selected', html:'english'}, | 73 | {tag:'li', cls:'selected', html:'english'}, |
76 | {tag:'li', html:'italiano'}, | 74 | {tag:'li', html:'italiano'}, |
77 | {tag:'li', html:'dutch'}, | 75 | {tag:'li', html:'dutch'}, |
78 | {tag:'li', html:'french'}, | 76 | {tag:'li', html:'french'}, |
79 | {tag:'li', html:'spanish'}, | 77 | {tag:'li', html:'spanish'}, |
80 | {tag:'li', html:'chinese'}, | 78 | {tag:'li', html:'chinese'}, |
81 | {tag:'li', html:'japanese'}, | 79 | {tag:'li', html:'japanese'}, |
82 | {tag:'li', html:'portugal'}, | 80 | {tag:'li', html:'portugal'}, |
83 | {tag:'li', html:'arabic'} | 81 | {tag:'li', html:'arabic'} |
84 | ]} | 82 | ]} |
85 | ]}, | 83 | ]}, |
86 | 84 | ||
87 | {tag:'input', id:this.getId('submitButton'), type:'submit', value:'login', cls:'submit'} | 85 | {tag:'input', id:this.getId('submitButton'), type:'submit', value:'login', cls:'submit'} |
88 | ]} | 86 | ]} |
89 | ]} | 87 | ]} |
90 | ]} | 88 | ]} |
91 | ]}, | 89 | ]}, |
92 | {tag:'div', cls:'footer'} | 90 | {tag:'div', cls:'footer'} |
93 | ]}); | 91 | ]}); |
94 | 92 | ||
95 | if (this.autocomplete() == 'off') { | 93 | if (this.autocomplete() == 'off') { |
96 | MochiKit.DOM.updateNodeAttributes(this.getElement('form'), {autocomplete:'off'}); | 94 | MochiKit.DOM.updateNodeAttributes(this.getElement('form'), {autocomplete:'off'}); |
97 | } | 95 | } |
98 | 96 | ||
99 | // Clipperz.Style.setBackgroundGradient(this.getElement('body'), {from:"#ff9955", to:"#ff6622"}) | 97 | // Clipperz.Style.setBackgroundGradient(this.getElement('body'), {from:"#ff9955", to:"#ff6622"}) |
100 | 98 | ||
101 | // this.setEntropyDisplay(new Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay(this.getElement('passphraseField'))); | 99 | // this.setEntropyDisplay(new Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay(this.getElement('passphraseField'))); |
102 | 100 | ||
103 | // MochiKit.Signal.connect(this.getId('otpCheckbox'), 'onclick', this, 'togglePasswordFields'); | 101 | // MochiKit.Signal.connect(this.getId('otpCheckbox'), 'onclick', this, 'togglePasswordFields'); |
104 | // this.showPassphraseField(); | 102 | // this.showPassphraseField(); |
105 | 103 | ||
106 | this.getElement('usernameField').focus(); | 104 | this.getElement('usernameField').focus(); |
107 | 105 | ||
108 | MochiKit.Signal.connect(this.getElement('loginForm'), 'onsubmit', this, 'loginEventHandler'); | 106 | MochiKit.Signal.connect(this.getElement('loginForm'), 'onsubmit', this, 'loginEventHandler'); |
109 | }, | 107 | }, |
110 | 108 | ||
111 | //----------------------------------------------------------------------------- | 109 | //----------------------------------------------------------------------------- |
112 | /* | 110 | /* |
113 | 'togglePasswordFields': function(anEvent) { | 111 | 'togglePasswordFields': function(anEvent) { |
114 | var shouldUseOTP; | 112 | var shouldUseOTP; |
115 | 113 | ||
116 | shouldUseOTP = this.getElement('otpCheckbox').checked; | 114 | shouldUseOTP = this.getElement('otpCheckbox').checked; |
117 | 115 | ||
118 | if (shouldUseOTP == false) { | 116 | if (shouldUseOTP == false) { |