Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/DataModel/User.js') (more/less context) (show whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/DataModel/User.js | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/User.js b/frontend/gamma/js/Clipperz/PM/DataModel/User.js index e8afa97..72d4006 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/User.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.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 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
30 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
31 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } | 28 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } |
32 | 29 | ||
33 | 30 | ||
34 | //############################################################################# | 31 | //############################################################################# |
35 | 32 | ||
36 | Clipperz.PM.DataModel.User = function (args) { | 33 | Clipperz.PM.DataModel.User = function (args) { |
37 | args = args || {}; | 34 | args = args || {}; |
38 | 35 | ||
39 | Clipperz.PM.DataModel.User.superclass.constructor.apply(this, arguments); | 36 | Clipperz.PM.DataModel.User.superclass.constructor.apply(this, arguments); |
40 | 37 | ||
41 | this._username = args.username || null; | 38 | this._username = args.username || null; |
42 | this._getPassphraseFunction = args.getPassphraseFunction || null; | 39 | this._getPassphraseFunction = args.getPassphraseFunction || null; |
43 | 40 | ||
44 | this._data = null; | 41 | this._data = null; |
45 | 42 | ||
46 | this._connection = null; | 43 | this._connection = null; |
47 | this._connectionVersion = 'current'; | 44 | this._connectionVersion = 'current'; |
48 | 45 | ||
49 | this._serverData = null; | 46 | this._serverData = null; |
50 | this._serverLockValue = null; | 47 | this._serverLockValue = null; |
51 | this._transientState = null; | 48 | this._transientState = null; |
52 | 49 | ||
53 | this._deferredLocks = { | 50 | this._deferredLocks = { |
54 | 'passphrase': new MochiKit.Async.DeferredLock(), | 51 | 'passphrase': new MochiKit.Async.DeferredLock(), |
55 | 'serverData': new MochiKit.Async.DeferredLock(), | 52 | 'serverData': new MochiKit.Async.DeferredLock(), |
56 | // 'recordsIndex': new MochiKit.Async.DeferredLock(), | 53 | // 'recordsIndex': new MochiKit.Async.DeferredLock(), |
57 | // 'directLoginsIndex':new MochiKit.Async.DeferredLock() | 54 | // 'directLoginsIndex':new MochiKit.Async.DeferredLock() |
58 | // 'preferences': new MochiKit.Async.DeferredLock() | 55 | // 'preferences': new MochiKit.Async.DeferredLock() |
59 | // 'oneTimePasswords': new MochiKit.Async.DeferredLock() | 56 | // 'oneTimePasswords': new MochiKit.Async.DeferredLock() |
60 | '__syntaxFix__': 'syntax fix' | 57 | '__syntaxFix__': 'syntax fix' |
61 | }; | 58 | }; |
62 | 59 | ||
63 | return this; | 60 | return this; |
64 | } | 61 | } |
65 | 62 | ||
66 | Clipperz.Base.extend(Clipperz.PM.DataModel.User, Object, { | 63 | Clipperz.Base.extend(Clipperz.PM.DataModel.User, Object, { |
67 | 64 | ||
68 | 'toString': function () { | 65 | 'toString': function () { |
69 | return "Clipperz.PM.DataModel.User - " + this.username(); | 66 | return "Clipperz.PM.DataModel.User - " + this.username(); |
70 | }, | 67 | }, |
71 | 68 | ||
72 | //------------------------------------------------------------------------- | 69 | //------------------------------------------------------------------------- |
73 | 70 | ||
74 | 'username': function () { | 71 | 'username': function () { |
75 | return this._username; | 72 | return this._username; |
76 | }, | 73 | }, |
77 | 74 | ||
78 | 'setUsername': function (aValue) { | 75 | 'setUsername': function (aValue) { |
79 | this._username = aValue; | 76 | this._username = aValue; |
80 | }, | 77 | }, |
81 | 78 | ||
82 | //------------------------------------------------------------------------- | 79 | //------------------------------------------------------------------------- |
83 | 80 | ||
84 | 'displayName': function() { | 81 | 'displayName': function() { |
85 | return "" + this.username() + ""; | 82 | return "" + this.username() + ""; |
86 | }, | 83 | }, |
87 | 84 | ||
88 | //------------------------------------------------------------------------- | 85 | //------------------------------------------------------------------------- |
89 | 86 | ||
90 | 'data': function () { | 87 | 'data': function () { |
91 | if (this._data == null) { | 88 | if (this._data == null) { |
92 | this._data = new Clipperz.KeyValueObjectStore(/*{'name':'User.data [1]'}*/); | 89 | this._data = new Clipperz.KeyValueObjectStore(/*{'name':'User.data [1]'}*/); |
93 | }; | 90 | }; |
94 | 91 | ||
95 | return this._data; | 92 | return this._data; |
96 | }, | 93 | }, |
97 | 94 | ||
98 | //------------------------------------------------------------------------- | 95 | //------------------------------------------------------------------------- |
99 | 96 | ||
100 | 'serverLockValue': function () { | 97 | 'serverLockValue': function () { |
101 | return this._serverLockValue; | 98 | return this._serverLockValue; |
102 | }, | 99 | }, |
103 | 100 | ||
104 | 'setServerLockValue': function (aValue) { | 101 | 'setServerLockValue': function (aValue) { |
105 | this._serverLockValue = aValue; | 102 | this._serverLockValue = aValue; |
106 | }, | 103 | }, |
107 | 104 | ||
108 | //------------------------------------------------------------------------- | 105 | //------------------------------------------------------------------------- |
109 | 106 | ||
110 | 'transientState': function () { | 107 | 'transientState': function () { |
111 | if (this._transientState == null) { | 108 | if (this._transientState == null) { |
112 | this._transientState = {} | 109 | this._transientState = {} |
113 | } | 110 | } |
114 | 111 | ||
115 | return this._transientState; | 112 | return this._transientState; |
116 | }, | 113 | }, |
117 | 114 | ||
118 | 'resetTransientState': function (isCommitting) { | 115 | 'resetTransientState': function (isCommitting) { |
119 | this._transientState = null; | 116 | this._transientState = null; |
120 | }, | 117 | }, |