diff --git a/js/9.9.9/evts.js b/js/9.9.9/evts.js
index ddad591..2af8d24 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 { getUsrId } from "./scripts.js";
function showMenu() {
var x = document.getElementById("navMob");
@@ -174,7 +173,7 @@ function clickImportFiles() {
modal.replaceWith(modal.cloneNode(true));
modalNotifier(
"Files saved to server
would you like to download them?"
,0);
break;
diff --git a/js/9.9.9/init.js b/js/9.9.9/init.js
index e1cb51d..760c935 100644
--- a/js/9.9.9/init.js
+++ b/js/9.9.9/init.js
@@ -10,8 +10,7 @@ import {
import { buildFile } from "./files.js";
import setPassword, {
passwordHash,
- inputRead,
- getUsrId,
+ inputRead
} from "./scripts.js";
import parseFormOnSubmit from "./parseForm.js";
import { createStorageObj, storeSettings } from "./storage.js";
@@ -54,10 +53,6 @@ function init() {
//init passwordhash to retrieve cookie info and set passwordHash
passwordHash.initHash();
- //set user id
- activeState.userId = getUsrId();
-
-
//check if user is logged in
if (passwordHash.verify()) {
//user logged in
diff --git a/js/9.9.9/scripts.js b/js/9.9.9/scripts.js
index 04ce91f..9bf577d 100644
--- a/js/9.9.9/scripts.js
+++ b/js/9.9.9/scripts.js
@@ -28,6 +28,8 @@ export const passwordHash = {
if (verifiedStatus == true) {
+ //set user id
+ activeState.userId = getUsrId();
setCookie(sha256(this.name), XORCipher.encode(sha256(this.name), this), 10);
}
},
@@ -95,7 +97,7 @@ function cyrb53(str, seed = 21) {
return 4294967296 * (2097151 & h2) + (h1 >>> 0);
}
-export function getUsrId() {
+function getUsrId() {
const fingerprint = getBrowserFingerprint( { hardwareOnly: true } );
return cyrb53(fingerprint + passwordHash);
}
diff --git a/js/9.9.9/storage.js b/js/9.9.9/storage.js
index f44806c..7ca5259 100644
--- a/js/9.9.9/storage.js
+++ b/js/9.9.9/storage.js
@@ -1,6 +1,6 @@
import XORCipher from "./xorc.js";
import sha256 from "./sha256.min.js";
-import { getCurrentDate, getUsrId, passwordHash, sanitize } from "./scripts.js";
+import { getCurrentDate, passwordHash, sanitize } from "./scripts.js";
const store = {
getItem: function (key) {return getStor().getItem(key)},
@@ -211,7 +211,7 @@ function createBookShelf() {
let saveFileName = date.current_time + "_" + date.current_date;
if (tF != null) {
- bookShelf[0] = { name: "hash", data: getUsrId(), ts: saveFileName };
+ bookShelf[0] = { name: "hash", data: activeState.userId, ts: saveFileName };
let i = 1;
for (let tFi of tF) {
let data = retrieveData(tFi.fileName, tFi.template);
@@ -255,7 +255,7 @@ function importBookShelf() {
}
}
};
- xhttp.open("GET", "php/?getStoredFiles=" + getUsrId(), true);
+ xhttp.open("GET", "php/?getStoredFiles=" + activeState.userId, true);
xhttp.setRequestHeader(
"Content-type",
"application/x-www-form-urlencoded; charset=UTF-8"
diff --git a/js/9.9.9/web.js b/js/9.9.9/web.js
index a484825..fefd1e6 100644
--- a/js/9.9.9/web.js
+++ b/js/9.9.9/web.js
@@ -3,7 +3,7 @@ import { loadFileDivCallBack } from "./files.js";
import { retrieveData, clearData, getFileName } from "./storage.js";
import { insertTextBlocks, modalNotifier, resetNavBar } from "./evts.js";
import { createTemplate, createTemplateCallBack} from "./createTemplate.js";
-import { getUsrId, logout, passwordHash } from "./scripts.js";
+import { logout, passwordHash } from "./scripts.js";
import buildSettings from "./settings.js";
@@ -264,7 +264,7 @@ function checkForStoredDataOnServer() {
}
}
};
- xhttp.open("GET", "php/?storedFiles="+getUsrId(), true);
+ xhttp.open("GET", "php/?storedFiles="+activeState.userId, true);
xhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=UTF-8');
xhttp.send();
}
@@ -279,7 +279,7 @@ function delStoredDataOnServer() {
}
}
};
- xhttp.open("GET", "php/?storedFiles="+getUsrId()+"&del", true);
+ xhttp.open("GET", "php/?storedFiles="+activeState.userId+"&del", true);
xhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=UTF-8');
xhttp.send();
}