From ea9a711a4c584f9cf7eaeeac4f15afd79e4563ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20L=2E=20=C5=A0ijanec?= Date: Thu, 14 May 2020 20:03:44 +0200 Subject: it works on my machine -- messaging.js --- js/messaging.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/js/messaging.js b/js/messaging.js index c34e242..7ef3386 100644 --- a/js/messaging.js +++ b/js/messaging.js @@ -418,11 +418,11 @@ async function validateName() { if ($("#full-name").val() in directory) { $("#full-name").addClass("valid"); $("#full-name").removeClass("invalid"); - $("#msg-send").prop("disabled", false); + $("#msg-send").removeAttr("disabled"); } else { $("#full-name").addClass("invalid"); $("#full-name").removeClass("valid"); - $("#msg-send").prop("disabled", true); + $("#msg-send").attr("disabled", "disabled"); } } } @@ -493,7 +493,7 @@ function setupEventListeners() { localforage.getItem("directory").then(function (value) { var msgcontent = $("#msg-body").val() + additionalstufftoaddtomessage; var msgsubject = $("#msg-subject").val(); - if ($("#msg-e2ee-pass").prop("hidden") !== true) { + if ($("#encryption-key-input").prop("hidden") !== true) { var randomencdivid = Math.floor(Math.random() * 9999).toString().padStart(4, "0"); var addrparts = window.location.href.split("/"); // engleski @@ -530,7 +530,8 @@ function setupEventListeners() { $("#msg-body").val(""); $("#full-name").val(""); $("#msg-subject").val(""); - $("#msg-send").prop("disabled", true); + // $("#msg-send").prop("disabled", true); + $("#msg-send").attr("disabled", "disabled"); additionalstufftoaddtomessage = ""; $("#msg-added-image").html(""); @@ -605,4 +606,4 @@ document.addEventListener("DOMContentLoaded", () => { // Setup side menu const menus = document.querySelectorAll(".side-menu"); M.Sidenav.init(menus, { edge: "right", draggable: true }); -}); \ No newline at end of file +}); -- cgit v1.2.3 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/lang/bundle.js | 2 ++ 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. -- cgit v1.2.3 From 762863194dfd4b2c768a49dc9b7400841954f7e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20L=2E=20=C5=A0ijanec?= Date: Thu, 14 May 2020 20:21:09 +0200 Subject: always run the code before commiting --- js/messaging.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/messaging.js b/js/messaging.js index 7de42cf..3ac9e99 100644 --- a/js/messaging.js +++ b/js/messaging.js @@ -283,7 +283,7 @@ function displayMessage(id, data) { $('#beziapp-msg-e2ee-content-${randomencdivid}').show(); $('#beziapp-msg-e2ee-form-${randomencdivid}').hide(); } catch (err) { - alert(${D("incorrectPassword")}); + alert('${D("incorrectPassword")}'); } " > @@ -520,7 +520,7 @@ function setupEventListeners() { $('#beziapp-msg-e2ee-content-${randomencdivid}').show(); $('#beziapp-msg-e2ee-form-${randomencdivid}').hide(); } catch(err) { - alert(${D("incorrectPassword")}); + alert('${D("incorrectPassword")}'); } " > -- cgit v1.2.3