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