author | Clipperz <info@clipperz.com> | 2013-01-31 13:42:04 (UTC) |
---|---|---|
committer | Clipperz <info@clipperz.com> | 2013-01-31 13:42:04 (UTC) |
commit | 07d0357beef5d9328a2dd8d07ad7b39c87ac55e4 (patch) (unidiff) | |
tree | f7a4aed8848302db153c2a211f8e58b944eb4c5b /frontend/beta/js/Clipperz/PM/DataModel/OneTimePasswordManager.js | |
parent | 767a3dcf48b6ac911c088af5dd7738a728eb6b99 (diff) | |
download | clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.zip clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.gz clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.bz2 |
Updated Copyright claims
- updated reference dates;
- removed reference to Community Edition;
- normalized logging using Clipperz.log[Warn|Error|Debug]
Diffstat (limited to 'frontend/beta/js/Clipperz/PM/DataModel/OneTimePasswordManager.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/beta/js/Clipperz/PM/DataModel/OneTimePasswordManager.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/OneTimePasswordManager.js b/frontend/beta/js/Clipperz/PM/DataModel/OneTimePasswordManager.js index aa40aba..1ebb615 100644 --- a/frontend/beta/js/Clipperz/PM/DataModel/OneTimePasswordManager.js +++ b/frontend/beta/js/Clipperz/PM/DataModel/OneTimePasswordManager.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 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } | 26 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } |
29 | 27 | ||
30 | 28 | ||
31 | //############################################################################# | 29 | //############################################################################# |
32 | 30 | ||
33 | Clipperz.PM.DataModel.OneTimePasswordManager = function(anUser, args) { | 31 | Clipperz.PM.DataModel.OneTimePasswordManager = function(anUser, args) { |
34 | args = args || {}; | 32 | args = args || {}; |
35 | 33 | ||
36 | this._user = anUser; | 34 | this._user = anUser; |
37 | this._oneTimePasswords = {}; | 35 | this._oneTimePasswords = {}; |
38 | 36 | ||
39 | this.updateWithData(args); | 37 | this.updateWithData(args); |
40 | 38 | ||
41 | Clipperz.NotificationCenter.notify(null, 'oneTimePasswordAdded', null, true); | 39 | Clipperz.NotificationCenter.notify(null, 'oneTimePasswordAdded', null, true); |
42 | 40 | ||
43 | return this; | 41 | return this; |
44 | } | 42 | } |
45 | 43 | ||
46 | Clipperz.PM.DataModel.OneTimePasswordManager.prototype = MochiKit.Base.update(null, { | 44 | Clipperz.PM.DataModel.OneTimePasswordManager.prototype = MochiKit.Base.update(null, { |
47 | 45 | ||
48 | 'toString': function() { | 46 | 'toString': function() { |
49 | return "Clipperz.PM.DataModel.OneTimePasswordManager"; | 47 | return "Clipperz.PM.DataModel.OneTimePasswordManager"; |
50 | }, | 48 | }, |
51 | 49 | ||
52 | //------------------------------------------------------------------------- | 50 | //------------------------------------------------------------------------- |
53 | 51 | ||
54 | 'updateWithData': function(someValues) { | 52 | 'updateWithData': function(someValues) { |
55 | varotpReference; | 53 | varotpReference; |
56 | 54 | ||
57 | //console.log("OneTimePasswordManager.updateWithData", someValues); | 55 | //console.log("OneTimePasswordManager.updateWithData", someValues); |
58 | //MochiKit.Logging.logDebug("OneTimePasswordManager.updateWithData: " + Clipperz.Base.serializeJSON(someValues)); | 56 | //MochiKit.Logging.logDebug("OneTimePasswordManager.updateWithData: " + Clipperz.Base.serializeJSON(someValues)); |
59 | for (otpReference in someValues) { | 57 | for (otpReference in someValues) { |
60 | var otp; | 58 | var otp; |
61 | var otpConfiguration; | 59 | var otpConfiguration; |
62 | 60 | ||
63 | otpConfiguration = someValues[otpReference]; | 61 | otpConfiguration = someValues[otpReference]; |
64 | otpConfiguration['user'] = this.user(); | 62 | otpConfiguration['user'] = this.user(); |
65 | otpConfiguration['reference'] = otpReference; | 63 | otpConfiguration['reference'] = otpReference; |
66 | otp = new Clipperz.PM.DataModel.OneTimePassword(otpConfiguration); | 64 | otp = new Clipperz.PM.DataModel.OneTimePassword(otpConfiguration); |
67 | this._oneTimePasswords[otpReference] = otp; | 65 | this._oneTimePasswords[otpReference] = otp; |
68 | } | 66 | } |
69 | 67 | ||
70 | return this; | 68 | return this; |
71 | }, | 69 | }, |
72 | 70 | ||
73 | //------------------------------------------------------------------------- | 71 | //------------------------------------------------------------------------- |
74 | 72 | ||
75 | 'updateWithServerData': function(someValues) { | 73 | 'updateWithServerData': function(someValues) { |
76 | var deferredResult; | 74 | var deferredResult; |
77 | varoneTimePasswordReference; | 75 | varoneTimePasswordReference; |
78 | var wereChangesApplied; | 76 | var wereChangesApplied; |
79 | 77 | ||
80 | //MochiKit.Logging.logDebug(">>> OneTimePasswordManager.updateWithServerData"); | 78 | //MochiKit.Logging.logDebug(">>> OneTimePasswordManager.updateWithServerData"); |
81 | deferredResult = new MochiKit.Async.Deferred(); | 79 | deferredResult = new MochiKit.Async.Deferred(); |
82 | wereChangesApplied = false; | 80 | wereChangesApplied = false; |
83 | 81 | ||
84 | for (oneTimePasswordReference in someValues) { | 82 | for (oneTimePasswordReference in someValues) { |
85 | var oneTimePassword; | 83 | var oneTimePassword; |
86 | 84 | ||
87 | oneTimePassword = this.oneTimePasswordWithReference(oneTimePasswordReference); | 85 | oneTimePassword = this.oneTimePasswordWithReference(oneTimePasswordReference); |
88 | if (oneTimePassword != null) { | 86 | if (oneTimePassword != null) { |
89 | var oneTimePasswordHasBeenUpdated; | 87 | var oneTimePasswordHasBeenUpdated; |
90 | 88 | ||
91 | oneTimePasswordHasBeenUpdated = oneTimePassword.updateStatusWithValues(someValues[oneTimePasswordReference]); | 89 | oneTimePasswordHasBeenUpdated = oneTimePassword.updateStatusWithValues(someValues[oneTimePasswordReference]); |
92 | wereChangesApplied = oneTimePasswordHasBeenUpdated || wereChangesApplied; | 90 | wereChangesApplied = oneTimePasswordHasBeenUpdated || wereChangesApplied; |
93 | } else { | 91 | } else { |
94 | 92 | ||
95 | } | 93 | } |
96 | } | 94 | } |
97 | 95 | ||
98 | if (wereChangesApplied == true) { | 96 | if (wereChangesApplied == true) { |
99 | this.user().header().markSectionAsUpdated('oneTimePasswords'); | 97 | this.user().header().markSectionAsUpdated('oneTimePasswords'); |
100 | } | 98 | } |
101 | 99 | ||
102 | for (oneTimePasswordReference in this.oneTimePasswords()) { | 100 | for (oneTimePasswordReference in this.oneTimePasswords()) { |
103 | if (typeof(someValues[oneTimePasswordReference]) == 'undefind') { | 101 | if (typeof(someValues[oneTimePasswordReference]) == 'undefind') { |
104 | deferredResult.addCallback(MochiKit.Base.method(this.oneTimePasswordWithReference(oneTimePasswordReference), 'saveChanges')); | 102 | deferredResult.addCallback(MochiKit.Base.method(this.oneTimePasswordWithReference(oneTimePasswordReference), 'saveChanges')); |
105 | } | 103 | } |
106 | } | 104 | } |
107 | 105 | ||
108 | deferredResult.addCallback(MochiKit.Async.succeed, this); | 106 | deferredResult.addCallback(MochiKit.Async.succeed, this); |
109 | 107 | ||
110 | deferredResult.callback(); | 108 | deferredResult.callback(); |
111 | //MochiKit.Logging.logDebug("<<< OneTimePasswordManager.updateWithServerData"); | 109 | //MochiKit.Logging.logDebug("<<< OneTimePasswordManager.updateWithServerData"); |
112 | 110 | ||
113 | return deferredResult; | 111 | return deferredResult; |
114 | }, | 112 | }, |
115 | 113 | ||
116 | //------------------------------------------------------------------------- | 114 | //------------------------------------------------------------------------- |
117 | 115 | ||
118 | 'user': function() { | 116 | 'user': function() { |