+
+
{{signed_message}}
+
+ -
+ {{key}}: {{prettyPrint(value)}}
+
+
Signing address:
diff --git a/src/js/controllers/correspondentDevice.js b/src/js/controllers/correspondentDevice.js
index 033e7eef8..15c99de86 100644
--- a/src/js/controllers/correspondentDevice.js
+++ b/src/js/controllers/correspondentDevice.js
@@ -89,6 +89,14 @@ angular.module('copayApp.controllers').controller('correspondentDeviceController
removeNewMessagesDelim();
});
+ $scope.isString = function(variable) {
+ return typeof variable === 'string';
+ };
+
+ $scope.prettyPrint = function(variable) {
+ return $scope.isString(variable) ? variable : JSON.stringify(variable, null, '\t');
+ };
+
$scope.send = function() {
$scope.error = null;
if (!$scope.message)
@@ -1018,7 +1026,7 @@ angular.module('copayApp.controllers').controller('correspondentDeviceController
var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.color = fc.backgroundColor;
$scope.bDisabled = true;
- $scope.message_to_sign = correspondentListService.escapeHtmlAndInsertBr(object_to_sign ? JSON.stringify(object_to_sign, null, '\t') : message_to_sign);
+ $scope.message_to_sign = object_to_sign ? object_to_sign : message_to_sign;
readMyPaymentAddress(fc, function(address){
$scope.address = address;
var arrAddreses = (object_to_sign ? json : message_to_sign).match(/\b[2-7A-Z]{32}\b/g) || [];
@@ -1109,7 +1117,7 @@ angular.module('copayApp.controllers').controller('correspondentDeviceController
var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.color = fc.backgroundColor;
- $scope.signed_message = correspondentListService.escapeHtmlAndInsertBr(typeof objSignedMessage.signed_message === 'string' ? objSignedMessage.signed_message : JSON.stringify(objSignedMessage.signed_message, null, '\t'));
+ $scope.signed_message = objSignedMessage.signed_message;
$scope.address = objSignedMessage.authors[0].address;
$scope.signature = signedMessageBase64;
var validation = require('ocore/validation.js');
diff --git a/src/js/controllers/preferencesInformation.js b/src/js/controllers/preferencesInformation.js
index f44dd6bb1..725ac1f8b 100644
--- a/src/js/controllers/preferencesInformation.js
+++ b/src/js/controllers/preferencesInformation.js
@@ -83,7 +83,7 @@ angular.module('copayApp.controllers').controller('preferencesInformation',
var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.color = fc.backgroundColor;
- $scope.signed_message = correspondentListService.escapeHtmlAndInsertBr(typeof objSignedMessage.signed_message === 'string' ? objSignedMessage.signed_message : JSON.stringify(objSignedMessage.signed_message, null, '\t'));
+ $scope.signed_message = objSignedMessage.signed_message;
$scope.address = objSignedMessage.authors[0].address;
$scope.signature = signedMessageBase64;
var validation = require('ocore/validation.js');
@@ -126,6 +126,14 @@ angular.module('copayApp.controllers').controller('preferencesInformation',
}; // verifySignedMessage
+ $scope.isString = function(variable) {
+ return typeof variable === 'string';
+ };
+
+ $scope.prettyPrint = function(variable) {
+ return $scope.isString(variable) ? variable : JSON.stringify(variable, null, '\t');
+ };
+
$scope.hasListOfBalances = function() {
return !!Object.keys($scope.assocListOfBalances || {}).length;
};
diff --git a/src/js/services/correspondentListService.js b/src/js/services/correspondentListService.js
index 55f0eeecf..c9e1888e1 100644
--- a/src/js/services/correspondentListService.js
+++ b/src/js/services/correspondentListService.js
@@ -225,15 +225,15 @@ angular.module('copayApp.services').factory('correspondentListService', function
if (!info)
return '
[invalid signed message]';
var objSignedMessage = info.objSignedMessage;
- var displayed_signed_message = (typeof objSignedMessage.signed_message === 'string') ? objSignedMessage.signed_message : JSON.stringify(objSignedMessage.signed_message, null, '\t');
+ var displayed_signed_message = (typeof objSignedMessage.signed_message === 'string') ? objSignedMessage.signed_message : JSON.stringify(objSignedMessage.signed_message);
var text = 'Message signed by '+objSignedMessage.authors[0].address+': '+escapeHtml(displayed_signed_message);
if (info.bValid)
text += " (valid)";
else if (info.bValid === false)
text += " (invalid)";
else
- text += ' (
verify)';
- return toDelayedReplacement('
['+text+']');
+ text += ' (verify)';
+ return toDelayedReplacement('
['+text+']');
}).replace(url_regexp, function(str){
param_index++;
params[param_index] = str;
@@ -381,7 +381,8 @@ angular.module('copayApp.services').factory('correspondentListService', function
catch(e){
return str; // it is already escapeHtml'd
}
- return escapeHtml(JSON.stringify(obj, null, '\t'));
+ //return escapeHtml(JSON.stringify(obj, null, '\t'));
+ return escapeHtml(JSON.stringify(obj));
}
function getPaymentsByAsset(objMultiPaymentRequest){
@@ -445,21 +446,21 @@ angular.module('copayApp.services').factory('correspondentListService', function
}).replace(/\[(.+?)\]\(profile-request:([\w,]+?)\)/g, function(str, description, fields_list){
return toDelayedReplacement('[Request for profile fields '+fields_list+']');
}).replace(/\[(.+?)\]\(sign-message-request:(.+?)\)/g, function(str, description, message_to_sign){
- return toDelayedReplacement('
[Request to sign message: '+message_to_sign+']');
+ return toDelayedReplacement('
[Request to sign message: '+tryParseBase64(message_to_sign)+']');
}).replace(/\[(.+?)\]\(signed-message:([\w\/+=]+?)\)/g, function(str, description, signedMessageBase64){
var info = getSignedMessageInfoFromJsonBase64(signedMessageBase64);
if (!info)
return '
[invalid signed message]';
var objSignedMessage = info.objSignedMessage;
- var displayed_signed_message = (typeof objSignedMessage.signed_message === 'string') ? objSignedMessage.signed_message : JSON.stringify(objSignedMessage.signed_message, null, '\t');
- var text = 'Message signed by '+objSignedMessage.authors[0].address+': '+escapeHtmlAndInsertBr(displayed_signed_message);
+ var displayed_signed_message = (typeof objSignedMessage.signed_message === 'string') ? objSignedMessage.signed_message : JSON.stringify(objSignedMessage.signed_message);
+ var text = 'Message signed by '+objSignedMessage.authors[0].address+': '+escapeHtml(displayed_signed_message);
if (info.bValid)
text += " (valid)";
else if (info.bValid === false)
text += " (invalid)";
else
- text += ' (
verify)';
- return toDelayedReplacement('
['+text+']');
+ text += ' (verify)';
+ return toDelayedReplacement('
['+text+']');
}).replace(url_regexp, function(str){
param_index++;
params[param_index] = str;