Commit ca9c215c authored by JC Brand's avatar JC Brand

Use a random passphrase to encrypt the private key. Updates #111

parent 20263057
...@@ -244,13 +244,6 @@ ...@@ -244,13 +244,6 @@
// Module-level functions // Module-level functions
// ---------------------- // ----------------------
// TODO: REMOVE
this.createLinks = function (text) {
// Convert URLs into hyperlinks
var re = /((http|https|ftp):\/\/[\w?=&.\/\-;#~%\-]+(?![\w\s?&.\/;#~%"=\-]*>))/g;
return text.replace(re, '<a target="_blank" href="$1">$1</a>');
};
this.giveFeedback = function (message, klass) { this.giveFeedback = function (message, klass) {
$('.conn-feedback').text(message); $('.conn-feedback').text(message);
$('.conn-feedback').attr('class', 'conn-feedback'); $('.conn-feedback').attr('class', 'conn-feedback');
...@@ -319,7 +312,6 @@ ...@@ -319,7 +312,6 @@
this.reconnect = function () { this.reconnect = function () {
converse.giveFeedback(__('Reconnecting'), 'error'); converse.giveFeedback(__('Reconnecting'), 'error');
// XXX: Couldn't get the prebind case to work here.
if (!converse.prebind) { if (!converse.prebind) {
this.connection.connect( this.connection.connect(
this.connection.jid, this.connection.jid,
...@@ -576,7 +568,17 @@ ...@@ -576,7 +568,17 @@
}, },
getSessionPassphrase: function () { getSessionPassphrase: function () {
return converse.prebind ? converse.connection.jid : converse.connection.pass; if (converse.prebind) {
var key = hex_sha1(converse.connection.jid),
pass = window.sessionStorage[key];
if (typeof pass === 'undefined') {
pass = Math.floor(Math.random()*4294967295);
window.sessionStorage[key] = pass;
}
return pass;
} else {
return converse.connection.pass;
}
}, },
generatePrivateKey: function (callback, instance_tag) { generatePrivateKey: function (callback, instance_tag) {
...@@ -2930,8 +2932,7 @@ ...@@ -2930,8 +2932,7 @@
}, this), }, this),
$.proxy(function (jid, fullname, img, img_type, url) { $.proxy(function (jid, fullname, img, img_type, url) {
converse.log("Error while retrieving vcard"); converse.log("Error while retrieving vcard");
// XXX: Should vcard_updated be set here as // XXX: Should vcard_updated be set here as well?
// well?
this.add({ this.add({
jid: bare_jid, jid: bare_jid,
subscription: 'none', subscription: 'none',
...@@ -2954,8 +2955,6 @@ ...@@ -2954,8 +2955,6 @@
var $presence = $(presence), var $presence = $(presence),
presence_type = $presence.attr('type'); presence_type = $presence.attr('type');
if (presence_type === 'error') { if (presence_type === 'error') {
// TODO
// error presence stanzas don't necessarily have a 'from' attr.
return true; return true;
} }
var jid = $presence.attr('from'), var jid = $presence.attr('from'),
...@@ -3303,7 +3302,7 @@ ...@@ -3303,7 +3302,7 @@
} else if (stat === 'away') { } else if (stat === 'away') {
pretty_status = __('away'); pretty_status = __('away');
} else { } else {
pretty_status = __(stat) || __('online'); // XXX: Is 'online' the right default choice here? pretty_status = __(stat) || __('online');
} }
return pretty_status; return pretty_status;
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment