From 24b5b6e842eb363dd2e5e5e8ed942befb43de50a Mon Sep 17 00:00:00 2001 From: maru21 Date: Sat, 28 Oct 2023 17:46:12 +0200 Subject: [PATCH] made modal non skippable --- index.html | 1 + js/9.9.9/createTemplate.js | 2 +- js/9.9.9/evts.js | 7 +++++-- js/9.9.9/files.js | 2 +- js/9.9.9/scripts.js | 19 +++++++++---------- js/9.9.9/settings.js | 2 +- js/9.9.9/storage.js | 1 - js/9.9.9/web.js | 2 +- 8 files changed, 19 insertions(+), 17 deletions(-) diff --git a/index.html b/index.html index 40b9e17..112f92b 100644 --- a/index.html +++ b/index.html @@ -343,6 +343,7 @@ ×
diff --git a/js/9.9.9/createTemplate.js b/js/9.9.9/createTemplate.js index dfad2f6..79cf38e 100644 --- a/js/9.9.9/createTemplate.js +++ b/js/9.9.9/createTemplate.js @@ -16,7 +16,7 @@ function createTemplate(template = false) { //sessionVerfication check if (!passwordHash.verify()) { - modalNotifier("Error: Session is not authenticated...", 0); + modalNotifier("Error: Session is not authenticated...", 0, false); } //reset navbar if files was used diff --git a/js/9.9.9/evts.js b/js/9.9.9/evts.js index 58bfa64..896b435 100644 --- a/js/9.9.9/evts.js +++ b/js/9.9.9/evts.js @@ -9,7 +9,6 @@ import { checkForStoredDataOnServer, delStoredDataOnServer } from "./web.js"; -import parseFormOnSubmit from "./parseForm.js"; import { getUsrId } from "./scripts.js"; function showMenu() { @@ -99,11 +98,15 @@ function hideMenus(evt) { tbBar.className = tbBar.className.replace(" w3-show", ""); } -function modalNotifier(msg, timeout = 3) { +function modalNotifier(msg, timeout = 3, closeable = true) { let modalElement = document.getElementById("modalNotifier"); + let modalElementCloseBtn = document.getElementById("modalNotifierClose"); let msgElement = document.getElementById("modalMsg"); modalElement.style.display = "block"; + + if (!closeable) modalElementCloseBtn.style.display = "none"; + msgElement.innerHTML = msg; if (timeout >= 1) { const run = setTimeout( diff --git a/js/9.9.9/files.js b/js/9.9.9/files.js index 966c6b2..1af1c90 100644 --- a/js/9.9.9/files.js +++ b/js/9.9.9/files.js @@ -31,7 +31,7 @@ function buildFile() { //sessionVerfication check if (!passwordHash.verify()) { - modalNotifier("Error: Session is not authenticated...", 0); + modalNotifier("Error: Session is not authenticated...", 0, false); } //disable toggleFiles Button diff --git a/js/9.9.9/scripts.js b/js/9.9.9/scripts.js index 3fe9a36..ed133b4 100644 --- a/js/9.9.9/scripts.js +++ b/js/9.9.9/scripts.js @@ -5,26 +5,25 @@ import getBrowserFingerprint from "./identify.js" export const passwordHash = { name: cyrb53("m21_"+getBrowserFingerprint( { hardwareOnly: true } )), - toString: () => { + toString: function () { let token = window.activeState.sessionToken; - if (token === null) return "none"; - if (token == "") return "none" - return XORCipher.decode(passwordHash.name, token); + if (token == null || token == "") return "none"; + return XORCipher.decode(this.name, token); }, - set: (pw) => { - activeState.sessionToken = XORCipher.encode(passwordHash.name, pw); + set: function (pw) { + activeState.sessionToken = XORCipher.encode(this.name, pw); }, init: function () { //check if cookie exists - if (getCookie(sha256(passwordHash.name)) != null) { - passwordHash.set(XORCipher.decode(sha256(passwordHash.name), getCookie(sha256(passwordHash.name)))); + if (getCookie(sha256(this.name)) != null) { + this.set(XORCipher.decode(sha256(this.name), getCookie(sha256(this.name)))); } let verifiedStatus = false; let tF = retrieveData("templateFiles"); if (tF != null) {verifiedStatus = true} if (verifiedStatus == true) { - setCookie(sha256(passwordHash.name), XORCipher.encode(sha256(passwordHash.name), passwordHash), 10) + setCookie(sha256(this.name), XORCipher.encode(sha256(this.name), this), 10); } }, verify: function () { @@ -104,7 +103,7 @@ function getCookie(cname) { export function logout() { let id = sha256(passwordHash.name); activeState.sessionToken = ""; - setCookie(sha256(passwordHash.name), "", 1); + setCookie(sha256(passwordHash.name), "", 10); document.cookie = id + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; document.getElementById("passwordField").value = ""; document.getElementById("login").style.display = "block"; diff --git a/js/9.9.9/settings.js b/js/9.9.9/settings.js index f645a36..7fb9205 100644 --- a/js/9.9.9/settings.js +++ b/js/9.9.9/settings.js @@ -16,7 +16,7 @@ const buildSettings = () => { //sessionVerfication check if (!passwordHash.verify()) { - modalNotifier("Error: Session is not authenticated...", 0); + modalNotifier("Error: Session is not authenticated...", 0, false); } //reset navbar if files was used diff --git a/js/9.9.9/storage.js b/js/9.9.9/storage.js index 1e0d2c9..da4f3fc 100644 --- a/js/9.9.9/storage.js +++ b/js/9.9.9/storage.js @@ -1,7 +1,6 @@ import XORCipher from "./xorc.js"; import sha256 from "./sha256.min.js"; import { getCurrentDate, getUsrId, passwordHash, sanitize } from "./scripts.js"; -import { printVersion } from "./evts.js"; const store = { getItem: function (key) {return getStor().getItem(key)}, diff --git a/js/9.9.9/web.js b/js/9.9.9/web.js index 79dfd75..9a3f7d4 100644 --- a/js/9.9.9/web.js +++ b/js/9.9.9/web.js @@ -71,7 +71,7 @@ function loadNewTemplate(template) { //sessionVerfication check if (!passwordHash.verify()) { - modalNotifier("Error: Session is not authenticated...", 0); + modalNotifier("Error: Session is not authenticated...", 0, false); } //set current page value in activeState object