From 87fc18f5be91502b348c68d05ebe0abef7d210d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20L=2E=20=C5=A0ijanec?= Date: Thu, 14 May 2020 20:18:06 +0200 Subject: e2ee msg error alert --- js/messaging.js | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) (limited to 'js/messaging.js') diff --git a/js/messaging.js b/js/messaging.js index 7ef3386..7de42cf 100644 --- a/js/messaging.js +++ b/js/messaging.js @@ -271,16 +271,20 @@ function displayMessage(id, data) { value="Decrypt" class="btn waves-effect waves-light" onclick=" - $('#beziapp-msg-e2ee-content-${randomencdivid}').html( - filterXSS( - sjcl.decrypt( - $('#beziapp-msg-e2ee-password-${randomencdivid}').val(), - $('#beziapp-msg-e2ee-content-${randomencdivid}').html() - ) - ) - ); - $('#beziapp-msg-e2ee-content-${randomencdivid}').show(); - $('#beziapp-msg-e2ee-form-${randomencdivid}').hide(); + try { + $('#beziapp-msg-e2ee-content-${randomencdivid}').html( + filterXSS( + sjcl.decrypt( + $('#beziapp-msg-e2ee-password-${randomencdivid}').val(), + $('#beziapp-msg-e2ee-content-${randomencdivid}').html() + ) + ) + ); + $('#beziapp-msg-e2ee-content-${randomencdivid}').show(); + $('#beziapp-msg-e2ee-form-${randomencdivid}').hide(); + } catch (err) { + alert(${D("incorrectPassword")}); + } " > ${S("decrypt")} @@ -505,15 +509,19 @@ function setupEventListeners() { This message was encrypted by BežiApp. -- cgit v1.2.3