summaryrefslogtreecommitdiff
path: root/frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js
Unidiff
Diffstat (limited to 'frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js22
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js b/frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js
index aee5703..c0cfa3c 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js
@@ -1,118 +1,116 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer 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
26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 24if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 25if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
28if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } 26if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
29 27
30 28
31//############################################################################# 29//#############################################################################
32 30
33Clipperz.PM.DataModel.DirectLogin = function(args) { 31Clipperz.PM.DataModel.DirectLogin = function(args) {
34//MochiKit.Logging.logDebug(">>> new Clipperz.PM.DataModel.DirectLogin"); 32//MochiKit.Logging.logDebug(">>> new Clipperz.PM.DataModel.DirectLogin");
35//console.log(">>> new Clipperz.PM.DataModel.DirectLogin - args: %o", args); 33//console.log(">>> new Clipperz.PM.DataModel.DirectLogin - args: %o", args);
36//console.log("--- formData: %s", Clipperz.Base.serializeJSON(args.formData)); 34//console.log("--- formData: %s", Clipperz.Base.serializeJSON(args.formData));
37 args = args || {}; 35 args = args || {};
38 36
39//MochiKit.Logging.logDebug("--- new Clipperz.PM.DataModel.DirectLogin - args: " + Clipperz.Base.serializeJSON(MochiKit.Base.keys(args))); 37//MochiKit.Logging.logDebug("--- new Clipperz.PM.DataModel.DirectLogin - args: " + Clipperz.Base.serializeJSON(MochiKit.Base.keys(args)));
40 this._record = args.record || null; 38 this._record = args.record || null;
41 this._label = args.label || "unnamed record" 39 this._label = args.label || "unnamed record"
42 this._reference = args.reference || Clipperz.PM.Crypto.randomKey(); 40 this._reference = args.reference || Clipperz.PM.Crypto.randomKey();
43 this._favicon = args.favicon || null; 41 this._favicon = args.favicon || null;
44 this._bookmarkletVersion = args.bookmarkletVersion || "0.1"; 42 this._bookmarkletVersion = args.bookmarkletVersion || "0.1";
45 43
46 this._directLoginInputs = null; 44 this._directLoginInputs = null;
47 45
48 this._formValues = args.formValues || {}; 46 this._formValues = args.formValues || {};
49 this.setFormData(args.formData || null); 47 this.setFormData(args.formData || null);
50//console.log("=== formData: %o", this.formData()); 48//console.log("=== formData: %o", this.formData());
51 49
52 if (args.legacyBindingData == null) { 50 if (args.legacyBindingData == null) {
53 this.setBindingData(args.bindingData || null); 51 this.setBindingData(args.bindingData || null);
54 } else { 52 } else {
55 this.setLegacyBindingData(args.legacyBindingData); 53 this.setLegacyBindingData(args.legacyBindingData);
56 } 54 }
57 55
58 this._fixedFavicon = null; 56 this._fixedFavicon = null;
59 57
60 //this._formValues = args.formValues || (this.hasValuesToSet() ? {} : null); 58 //this._formValues = args.formValues || (this.hasValuesToSet() ? {} : null);
61//MochiKit.Logging.logDebug("<<< new Clipperz.PM.DataModel.DirectLogin"); 59//MochiKit.Logging.logDebug("<<< new Clipperz.PM.DataModel.DirectLogin");
62 60
63 return this; 61 return this;
64} 62}
65 63
66Clipperz.PM.DataModel.DirectLogin.prototype = MochiKit.Base.update(null, { 64Clipperz.PM.DataModel.DirectLogin.prototype = MochiKit.Base.update(null, {
67 65
68 'remove': function() { 66 'remove': function() {
69 this.record().removeDirectLogin(this); 67 this.record().removeDirectLogin(this);
70 }, 68 },
71 69
72 //------------------------------------------------------------------------- 70 //-------------------------------------------------------------------------
73 71
74 'record': function() { 72 'record': function() {
75 return this._record; 73 return this._record;
76 }, 74 },
77 75
78 //------------------------------------------------------------------------- 76 //-------------------------------------------------------------------------
79 77
80 'user': function() { 78 'user': function() {
81 return this.record().user(); 79 return this.record().user();
82 }, 80 },
83 81
84 //------------------------------------------------------------------------- 82 //-------------------------------------------------------------------------
85 83
86 'reference': function() { 84 'reference': function() {
87 return this._reference; 85 return this._reference;
88 }, 86 },
89 87
90 //------------------------------------------------------------------------- 88 //-------------------------------------------------------------------------
91 89
92 'label': function() { 90 'label': function() {
93 return this._label; 91 return this._label;
94 }, 92 },
95 93
96 'setLabel': function(aValue) { 94 'setLabel': function(aValue) {
97 this._label = aValue; 95 this._label = aValue;
98 }, 96 },
99 97
100 //------------------------------------------------------------------------- 98 //-------------------------------------------------------------------------
101 99
102 'favicon': function() { 100 'favicon': function() {
103 if (this._favicon == null) { 101 if (this._favicon == null) {
104 varactionUrl; 102 varactionUrl;
105 var hostname; 103 var hostname;
106 104
107 actionUrl = this.formData()['attributes']['action']; 105 actionUrl = this.formData()['attributes']['action'];
108 hostname = actionUrl.replace(/^https?:\/\/([^\/]*)\/.*/, '$1'); 106 hostname = actionUrl.replace(/^https?:\/\/([^\/]*)\/.*/, '$1');
109 this._favicon = "http://" + hostname + "/favicon.ico"; 107 this._favicon = "http://" + hostname + "/favicon.ico";
110 } 108 }
111 109
112 return this._favicon; 110 return this._favicon;
113 }, 111 },
114 112
115 //------------------------------------------------------------------------- 113 //-------------------------------------------------------------------------
116 114
117 'fixedFavicon': function() { 115 'fixedFavicon': function() {
118 var result; 116 var result;