Diffstat (limited to 'frontend/beta/js/Clipperz/PM/DataModel') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js | 22 | ||||
-rw-r--r-- | frontend/beta/js/Clipperz/PM/DataModel/DirectLoginReference.js | 2 |
2 files changed, 16 insertions, 8 deletions
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js b/frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js index c0cfa3c..56d9d59 100644 --- a/frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js +++ b/frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js | |||
@@ -29,25 +29,25 @@ if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; | |||
29 | //############################################################################# | 29 | //############################################################################# |
30 | 30 | ||
31 | Clipperz.PM.DataModel.DirectLogin = function(args) { | 31 | Clipperz.PM.DataModel.DirectLogin = function(args) { |
32 | //MochiKit.Logging.logDebug(">>> new Clipperz.PM.DataModel.DirectLogin"); | 32 | //MochiKit.Logging.logDebug(">>> new Clipperz.PM.DataModel.DirectLogin"); |
33 | //console.log(">>> new Clipperz.PM.DataModel.DirectLogin - args: %o", args); | 33 | //console.log(">>> new Clipperz.PM.DataModel.DirectLogin - args: %o", args); |
34 | //console.log("--- formData: %s", Clipperz.Base.serializeJSON(args.formData)); | 34 | //console.log("--- formData: %s", Clipperz.Base.serializeJSON(args.formData)); |
35 | args = args || {}; | 35 | args = args || {}; |
36 | 36 | ||
37 | //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))); |
38 | this._record = args.record || null; | 38 | this._record = args.record || null; |
39 | this._label = args.label || "unnamed record" | 39 | this._label = args.label || "unnamed record" |
40 | this._reference = args.reference || Clipperz.PM.Crypto.randomKey(); | 40 | this._reference = args.reference || Clipperz.PM.Crypto.randomKey(); |
41 | this._favicon = args.favicon || null; | 41 | this._favicon = Clipperz.Base.sanitizeFavicon(args.favicon) || null; |
42 | this._bookmarkletVersion = args.bookmarkletVersion || "0.1"; | 42 | this._bookmarkletVersion = args.bookmarkletVersion || "0.1"; |
43 | 43 | ||
44 | this._directLoginInputs = null; | 44 | this._directLoginInputs = null; |
45 | 45 | ||
46 | this._formValues = args.formValues || {}; | 46 | this._formValues = args.formValues || {}; |
47 | this.setFormData(args.formData || null); | 47 | this.setFormData(args.formData || null); |
48 | //console.log("=== formData: %o", this.formData()); | 48 | //console.log("=== formData: %o", this.formData()); |
49 | 49 | ||
50 | if (args.legacyBindingData == null) { | 50 | if (args.legacyBindingData == null) { |
51 | this.setBindingData(args.bindingData || null); | 51 | this.setBindingData(args.bindingData || null); |
52 | } else { | 52 | } else { |
53 | this.setLegacyBindingData(args.legacyBindingData); | 53 | this.setLegacyBindingData(args.legacyBindingData); |
@@ -93,27 +93,27 @@ Clipperz.PM.DataModel.DirectLogin.prototype = MochiKit.Base.update(null, { | |||
93 | 93 | ||
94 | 'setLabel': function(aValue) { | 94 | 'setLabel': function(aValue) { |
95 | this._label = aValue; | 95 | this._label = aValue; |
96 | }, | 96 | }, |
97 | 97 | ||
98 | //------------------------------------------------------------------------- | 98 | //------------------------------------------------------------------------- |
99 | 99 | ||
100 | 'favicon': function() { | 100 | 'favicon': function() { |
101 | if (this._favicon == null) { | 101 | if (this._favicon == null) { |
102 | varactionUrl; | 102 | varactionUrl; |
103 | var hostname; | 103 | var hostname; |
104 | 104 | ||
105 | actionUrl = this.formData()['attributes']['action']; | 105 | actionUrl = this.action(); |
106 | hostname = actionUrl.replace(/^https?:\/\/([^\/]*)\/.*/, '$1'); | 106 | hostname = actionUrl.replace(/^https?:\/\/([^\/]*)\/.*/, '$1'); |
107 | this._favicon = "http://" + hostname + "/favicon.ico"; | 107 | this._favicon = Clipperz.Base.sanitizeFavicon("http://" + hostname + "/favicon.ico"); |
108 | } | 108 | } |
109 | 109 | ||
110 | return this._favicon; | 110 | return this._favicon; |
111 | }, | 111 | }, |
112 | 112 | ||
113 | //------------------------------------------------------------------------- | 113 | //------------------------------------------------------------------------- |
114 | 114 | ||
115 | 'fixedFavicon': function() { | 115 | 'fixedFavicon': function() { |
116 | var result; | 116 | var result; |
117 | 117 | ||
118 | if (this._fixedFavicon == null) { | 118 | if (this._fixedFavicon == null) { |
119 | result = this.favicon(); | 119 | result = this.favicon(); |
@@ -128,24 +128,32 @@ Clipperz.PM.DataModel.DirectLogin.prototype = MochiKit.Base.update(null, { | |||
128 | } | 128 | } |
129 | } else { | 129 | } else { |
130 | result = this._fixedFavicon; | 130 | result = this._fixedFavicon; |
131 | } | 131 | } |
132 | 132 | ||
133 | return result; | 133 | return result; |
134 | }, | 134 | }, |
135 | 135 | ||
136 | 'setFixedFavicon': function(aValue) { | 136 | 'setFixedFavicon': function(aValue) { |
137 | this._fixedFavicon = aValue; | 137 | this._fixedFavicon = aValue; |
138 | }, | 138 | }, |
139 | 139 | ||
140 | 'action': function () { | ||
141 | varresult; | ||
142 | |||
143 | result = Clipperz.Base.sanitizeUrl(this.formData()['attributes']['action']); | ||
144 | |||
145 | return result; | ||
146 | }, | ||
147 | |||
140 | //------------------------------------------------------------------------- | 148 | //------------------------------------------------------------------------- |
141 | 149 | ||
142 | 'bookmarkletVersion': function() { | 150 | 'bookmarkletVersion': function() { |
143 | return this._bookmarkletVersion; | 151 | return this._bookmarkletVersion; |
144 | }, | 152 | }, |
145 | 153 | ||
146 | 'setBookmarkletVersion': function(aValue) { | 154 | 'setBookmarkletVersion': function(aValue) { |
147 | this._bookmarkletVersion = aValue; | 155 | this._bookmarkletVersion = aValue; |
148 | }, | 156 | }, |
149 | 157 | ||
150 | //------------------------------------------------------------------------- | 158 | //------------------------------------------------------------------------- |
151 | 159 | ||
@@ -433,25 +441,25 @@ Clipperz.PM.DataModel.DirectLogin.prototype = MochiKit.Base.update(null, { | |||
433 | MochiKit.DOM.withWindow(aWindow, MochiKit.Base.bind(function() { | 441 | MochiKit.DOM.withWindow(aWindow, MochiKit.Base.bind(function() { |
434 | var formElement; | 442 | var formElement; |
435 | varformSubmitFunction; | 443 | varformSubmitFunction; |
436 | var submitButtons; | 444 | var submitButtons; |
437 | 445 | ||
438 | //MochiKit.Logging.logDebug("### runDirectLogin - 3"); | 446 | //MochiKit.Logging.logDebug("### runDirectLogin - 3"); |
439 | // MochiKit.DOM.currentDocument().write('<html><head><title>' + this.label() + '</title><META http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body></body></html>') | 447 | // MochiKit.DOM.currentDocument().write('<html><head><title>' + this.label() + '</title><META http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body></body></html>') |
440 | //MochiKit.Logging.logDebug("### runDirectLogin - 3.1"); | 448 | //MochiKit.Logging.logDebug("### runDirectLogin - 3.1"); |
441 | MochiKit.DOM.appendChildNodes(MochiKit.DOM.currentDocument().body, MochiKit.DOM.H3(null, "Loading " + this.label() + " ...")); | 449 | MochiKit.DOM.appendChildNodes(MochiKit.DOM.currentDocument().body, MochiKit.DOM.H3(null, "Loading " + this.label() + " ...")); |
442 | //MochiKit.Logging.logDebug("### runDirectLogin - 4"); | 450 | //MochiKit.Logging.logDebug("### runDirectLogin - 4"); |
443 | //console.log(this.formData()['attributes']); | 451 | //console.log(this.formData()['attributes']); |
444 | formElement = MochiKit.DOM.FORM(MochiKit.Base.update({id:'directLoginForm'}, {'method':this.formData()['attributes']['method'], | 452 | formElement = MochiKit.DOM.FORM(MochiKit.Base.update({id:'directLoginForm'}, {'method':this.formData()['attributes']['method'], |
445 | 'action':this.formData()['attributes']['action']})); | 453 | 'action': this.action()})); |
446 | //MochiKit.Logging.logDebug("### runDirectLogin - 5"); | 454 | //MochiKit.Logging.logDebug("### runDirectLogin - 5"); |
447 | formSubmitFunction = MochiKit.Base.method(formElement, 'submit'); | 455 | formSubmitFunction = MochiKit.Base.method(formElement, 'submit'); |
448 | //MochiKit.Logging.logDebug("### runDirectLogin - 6"); | 456 | //MochiKit.Logging.logDebug("### runDirectLogin - 6"); |
449 | 457 | ||
450 | MochiKit.DOM.appendChildNodes(MochiKit.DOM.currentDocument().body, | 458 | MochiKit.DOM.appendChildNodes(MochiKit.DOM.currentDocument().body, |
451 | MochiKit.DOM.DIV({style:'display:none; visibility:hidden;'}, formElement) | 459 | MochiKit.DOM.DIV({style:'display:none; visibility:hidden;'}, formElement) |
452 | ); | 460 | ); |
453 | //MochiKit.Logging.logDebug("### runDirectLogin - 7"); | 461 | //MochiKit.Logging.logDebug("### runDirectLogin - 7"); |
454 | MochiKit.DOM.appendChildNodes(formElement, MochiKit.Base.map(MochiKit.Base.methodcaller("formConfiguration"), | 462 | MochiKit.DOM.appendChildNodes(formElement, MochiKit.Base.map(MochiKit.Base.methodcaller("formConfiguration"), |
455 | this.directLoginInputs())); | 463 | this.directLoginInputs())); |
456 | //MochiKit.Logging.logDebug("### runDirectLogin - 8"); | 464 | //MochiKit.Logging.logDebug("### runDirectLogin - 8"); |
457 | 465 | ||
@@ -478,27 +486,27 @@ Clipperz.PM.DataModel.DirectLogin.prototype = MochiKit.Base.update(null, { | |||
478 | } | 486 | } |
479 | 487 | ||
480 | }, this)); | 488 | }, this)); |
481 | }, | 489 | }, |
482 | 490 | ||
483 | //------------------------------------------------------------------------- | 491 | //------------------------------------------------------------------------- |
484 | 492 | ||
485 | 'runDirectLogin': function(aNewWindow) { | 493 | 'runDirectLogin': function(aNewWindow) { |
486 | varnewWindow; | 494 | varnewWindow; |
487 | 495 | ||
488 | //console.log("formData.attributes", this.formData()['attributes']); | 496 | //console.log("formData.attributes", this.formData()['attributes']); |
489 | // if (/^javascript/.test(this.formData()['attributes']['action'])) { | 497 | // if (/^javascript/.test(this.formData()['attributes']['action'])) { |
490 | if ((/^(https?|webdav|ftp)\:/.test(this.formData()['attributes']['action']) == false) && | 498 | if ((/^(https?|webdav|ftp)\:/.test(this.action()) == false) && |
491 | (this.formData()['attributes']['type'] != 'http_auth')) | 499 | (this.formData()['attributes']['type'] != 'http_auth') |
492 | { | 500 | ) { |
493 | var messageBoxConfiguration; | 501 | var messageBoxConfiguration; |
494 | 502 | ||
495 | if (typeof(aNewWindow) != 'undefined') { | 503 | if (typeof(aNewWindow) != 'undefined') { |
496 | aNewWindow.close(); | 504 | aNewWindow.close(); |
497 | } | 505 | } |
498 | 506 | ||
499 | messageBoxConfiguration = {}; | 507 | messageBoxConfiguration = {}; |
500 | messageBoxConfiguration.title = Clipperz.PM.Strings['VulnerabilityWarning_Panel_title']; | 508 | messageBoxConfiguration.title = Clipperz.PM.Strings['VulnerabilityWarning_Panel_title']; |
501 | messageBoxConfiguration.msg = Clipperz.PM.Strings['VulnerabilityWarning_Panel_message']; | 509 | messageBoxConfiguration.msg = Clipperz.PM.Strings['VulnerabilityWarning_Panel_message']; |
502 | messageBoxConfiguration.animEl = YAHOO.ext.Element.get("mainDiv"); | 510 | messageBoxConfiguration.animEl = YAHOO.ext.Element.get("mainDiv"); |
503 | messageBoxConfiguration.progress = false; | 511 | messageBoxConfiguration.progress = false; |
504 | messageBoxConfiguration.closable = false; | 512 | messageBoxConfiguration.closable = false; |
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginReference.js b/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginReference.js index 236d7c9..ba302da 100644 --- a/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginReference.js +++ b/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginReference.js | |||
@@ -38,25 +38,25 @@ Clipperz.PM.DataModel.DirectLoginReference = function(args) { | |||
38 | if (args.directLogin != null) { | 38 | if (args.directLogin != null) { |
39 | this._reference = args.directLogin.reference(); | 39 | this._reference = args.directLogin.reference(); |
40 | this._recordReference = args.directLogin.record().reference(); | 40 | this._recordReference = args.directLogin.record().reference(); |
41 | this._label = args.directLogin.label(); | 41 | this._label = args.directLogin.label(); |
42 | this._favicon = args.directLogin.favicon() || null; | 42 | this._favicon = args.directLogin.favicon() || null; |
43 | 43 | ||
44 | this._directLogin = args.directLogin; | 44 | this._directLogin = args.directLogin; |
45 | this._record = args.directLogin.record(); | 45 | this._record = args.directLogin.record(); |
46 | } else { | 46 | } else { |
47 | this._reference = args.reference; | 47 | this._reference = args.reference; |
48 | this._recordReference = args.record; | 48 | this._recordReference = args.record; |
49 | this._label = args.label; | 49 | this._label = args.label; |
50 | this._favicon = args.favicon || null; | 50 | this._favicon = Clipperz.Base.sanitizeFavicon(args.favicon) || null; |
51 | 51 | ||
52 | this._directLogin = null; | 52 | this._directLogin = null; |
53 | this._record = null; | 53 | this._record = null; |
54 | } | 54 | } |
55 | 55 | ||
56 | this._fixedFavicon = null; | 56 | this._fixedFavicon = null; |
57 | 57 | ||
58 | return this; | 58 | return this; |
59 | } | 59 | } |
60 | 60 | ||
61 | Clipperz.PM.DataModel.DirectLoginReference.prototype = MochiKit.Base.update(null, { | 61 | Clipperz.PM.DataModel.DirectLoginReference.prototype = MochiKit.Base.update(null, { |
62 | 62 | ||