summaryrefslogtreecommitdiff
path: root/frontend/delta/js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js
Unidiff
Diffstat (limited to 'frontend/delta/js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/delta/js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js117
1 files changed, 117 insertions, 0 deletions
diff --git a/frontend/delta/js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js b/frontend/delta/js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js
new file mode 100644
index 0000000..e82da47
--- a/dev/null
+++ b/frontend/delta/js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js
@@ -0,0 +1,117 @@
1/*
2
3Copyright 2008-2013 Clipperz Srl
4
5This file is part of Clipperz, the online password manager.
6For further information about its features and functionalities please
7refer to http://www.clipperz.com.
8
9* Clipperz is free software: you can redistribute it and/or modify it
10 under the terms of the GNU Affero General Public License as published
11 by the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14* Clipperz is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 See the GNU Affero General Public License for more details.
18
19* You should have received a copy of the GNU Affero General Public
20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
21
22*/
23
24try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) {
25 throw "Clipperz.PM.DataModel.User.Header.OneTimePasswords depends on Clipperz.PM.DataModel.User!";
26}
27if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; }
28
29//-----------------------------------------------------------------------------
30
31Clipperz.PM.DataModel.User.Header.OneTimePasswords = function(args) {
32 Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.constructor.apply(this, arguments);
33
34 this._oneTimePasswords = null;
35
36 return this;
37}
38
39//-----------------------------------------------------------------------------
40
41Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.OneTimePasswords, Clipperz.PM.DataModel.EncryptedRemoteObject, {
42
43 'toString': function() {
44 return "Clipperz.PM.DataModel.User.Header.OneTimePasswords";
45 },
46
47 //-------------------------------------------------------------------------
48/*
49 'packData': function (someData) { //++
50 var result;
51
52 result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.packData.apply(this, arguments);
53
54 return result;
55 },
56*/
57 //-------------------------------------------------------------------------
58/*
59 'packRemoteData': function (someData) {
60 var result;
61
62 result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.packRemoteData.apply(this, arguments);
63
64 return result;
65 },
66*/
67 //-------------------------------------------------------------------------
68/*
69 'prepareRemoteDataWithKey': function (aKey) {
70 var result;
71
72 result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.prepareRemoteDataWithKey.apply(this, arguments);
73
74 return result;
75 },
76*/
77 //=========================================================================
78
79 'oneTimePasswords': function () {
80 vardeferredResult;
81
82 deferredResult = new Clipperz.Async.Deferred("User.Header.OneTimePasswords.oneTimePasswords", {trace:false});
83 if (this._oneTimePasswords == null) {
84 deferredResult.addMethod(this, 'values')
85 deferredResult.addCallback(MochiKit.Base.bind(function (someData) {
86 varotpKey;
87
88 this._oneTimePasswords = {};
89
90 for (otpKey in someData) {
91 var otp;
92 var otpParameters;
93
94 otpParameters = Clipperz.Base.deepClone(someData[otpKey]);
95 otpParameters['reference'] = otpKey;
96
97 otp = new Clipperz.PM.DataModel.OneTimePassword(otpParameters);
98 this._oneTimePasswords[otpKey] = otp;
99 }
100
101 return this._oneTimePasswords;
102
103 }, this));
104 deferredResult.callback();
105 } else {
106 deferredResult = MochiKit.Async.succeed(this._oneTimePasswords);
107 }
108
109 return deferredResult;
110 },
111
112 //=========================================================================
113 __syntaxFix__: "syntax fix"
114});
115
116//-----------------------------------------------------------------------------
117