diff options
author | Anton L. Šijanec <sijanecantonluka@gmail.com> | 2020-05-14 20:18:06 +0200 |
---|---|---|
committer | Anton L. Šijanec <sijanecantonluka@gmail.com> | 2020-05-14 20:18:06 +0200 |
commit | 87fc18f5be91502b348c68d05ebe0abef7d210d7 (patch) | |
tree | 0ff2164b0355802837778668be03e2d239ec6df9 | |
parent | it works on my machine -- messaging.js (diff) | |
download | beziapp-87fc18f5be91502b348c68d05ebe0abef7d210d7.tar beziapp-87fc18f5be91502b348c68d05ebe0abef7d210d7.tar.gz beziapp-87fc18f5be91502b348c68d05ebe0abef7d210d7.tar.bz2 beziapp-87fc18f5be91502b348c68d05ebe0abef7d210d7.tar.lz beziapp-87fc18f5be91502b348c68d05ebe0abef7d210d7.tar.xz beziapp-87fc18f5be91502b348c68d05ebe0abef7d210d7.tar.zst beziapp-87fc18f5be91502b348c68d05ebe0abef7d210d7.zip |
Diffstat (limited to '')
-rw-r--r-- | js/lang/bundle.js | 2 | ||||
-rw-r--r-- | js/messaging.js | 46 |
2 files changed, 29 insertions, 19 deletions
diff --git a/js/lang/bundle.js b/js/lang/bundle.js index bf1a361..e7dc1e6 100644 --- a/js/lang/bundle.js +++ b/js/lang/bundle.js @@ -211,6 +211,7 @@ var langstrings = { imageAddedAsAnAttachment: "image added as an attachment", unableToReadDirectory: "unable to read directory of people", messageCouldNotBeSent: "message could to be sent", + incorrectPassword: "incorrect password", // chats chat: "chat", chattingWith: "chatting with", @@ -393,6 +394,7 @@ var langstrings = { imageAddedAsAnAttachment: "slika dodana kot priloga", unableToReadDirectory: "imenika ni bilo mogoče prebrati", messageCouldNotBeSent: "sporočila ni bilo mogoče poslati", + incorrectPassword: "nepravilno geslo", // chats chat: "klepet", chattingWith: "klepet z osebo", 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. <input type="password" autocomplete="new-password" id="beziapp-msg-e2ee-password-${randomencdivid}" placeholder="Enter password ..."> <input type="button" value="Decrypt" onclick=" - console.log($('beziapp-msg-e2ee-content-${randomencdivid}').text()); - $('#beziapp-msg-e2ee-content-${randomencdivid}').html( - sjcl.decrypt( - $('#beziapp-msg-e2ee-password-${randomencdivid}').val(), - $('beziapp-msg-e2ee-content-${randomencdivid}').text() - ) - ); - $('#beziapp-msg-e2ee-content-${randomencdivid}').show(); - $('#beziapp-msg-e2ee-form-${randomencdivid}').hide(); + try { + console.log($('beziapp-msg-e2ee-content-${randomencdivid}').text()); + $('#beziapp-msg-e2ee-content-${randomencdivid}').html( + sjcl.decrypt( + $('#beziapp-msg-e2ee-password-${randomencdivid}').val(), + $('beziapp-msg-e2ee-content-${randomencdivid}').text() + ) + ); + $('#beziapp-msg-e2ee-content-${randomencdivid}').show(); + $('#beziapp-msg-e2ee-form-${randomencdivid}').hide(); + } catch(err) { + alert(${D("incorrectPassword")}); + } " > </div> |