made modal non skippable

This commit is contained in:
maru21 2023-10-28 17:46:12 +02:00
parent cf9a4e0efb
commit 24b5b6e842
8 changed files with 19 additions and 17 deletions

View File

@ -343,6 +343,7 @@
<span
onclick="this.parentElement.parentElement.style.display='none'"
class="w3-button w3-display-topright w3-flat-clouds"
id="modalNotifierClose"
>&times;</span
>
<div class="w3-container w3-padding-32 w3-flat-clouds">

View File

@ -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

View File

@ -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(

View File

@ -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

View File

@ -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";

View File

@ -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

View File

@ -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)},

View File

@ -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