backup + decriptare toate fisiere done

This commit is contained in:
andrei-mihnea-cerbu
2024-04-19 16:48:10 +03:00
parent ffeebf1177
commit 869305a491
55 changed files with 1073 additions and 265 deletions
+10 -4
View File
@@ -3,7 +3,7 @@ document.addEventListener('DOMContentLoaded', async function () {
const submitButton = document.getElementById('submit');
const signupDataExists = await window.electronAPI.checkFileExists('signupData.json');
if(signupDataExists){
if (signupDataExists) {
await window.electronAPI.deleteFile('signupData.json');
}
@@ -32,9 +32,11 @@ document.addEventListener('DOMContentLoaded', async function () {
email: email,
password: password
})
}).then(response => {
}).then(async response => {
if (response.ok) {
fadeOut('main_menu.html');
} else {
await window.electronAPI.deleteFile('loginData.json');
}
}).catch(error => {
console.error(error);
@@ -80,8 +82,8 @@ document.addEventListener('DOMContentLoaded', async function () {
return response.json();
}).then(async data => {
console.log(data)
await window.electronAPI.writeFile('loginData.json', JSON.stringify(responseBody.message, null, 2));
data.data.password = password
await window.electronAPI.writeFile('loginData.json', JSON.stringify(data.data, null, 2));
fadeOut('main_menu.html');
})
.catch(async error => {
@@ -90,4 +92,8 @@ document.addEventListener('DOMContentLoaded', async function () {
.catch(error => console.error('Error showing alert:', error));
})
});
function delayWithTimeout(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
});
+4 -4
View File
@@ -34,11 +34,11 @@ document.addEventListener('DOMContentLoaded', async function () {
handleOverlayOpen('decrypt');
});
ceoBackButton.addEventListener('click', function() {
ceoBackButton.addEventListener('click', function () {
overlay.style.display = 'none';
});
ceoSubmitButton.addEventListener('click', async function(event) {
ceoSubmitButton.addEventListener('click', async function (event) {
event.preventDefault();
const password = document.getElementById('ceo_password').value;
@@ -53,12 +53,12 @@ document.addEventListener('DOMContentLoaded', async function () {
})
}).then(async result => {
const data = await result.json();
if(!result.ok){
if (!result.ok) {
throw new Error(data.message);
}
if (triggerSource === 'change_department') {
fadeOut('change_department.html');
}else if (triggerSource === 'decrypt'){
} else if (triggerSource === 'decrypt') {
fadeOut('decrypting_files.html');
}
})
+2 -2
View File
@@ -1,4 +1,4 @@
document.addEventListener("DOMContentLoaded", function() {
document.addEventListener("DOMContentLoaded", function () {
let pathToFile = '';
function updateFileName() {
@@ -83,7 +83,7 @@ document.addEventListener("DOMContentLoaded", function() {
}
});
if(selectedUserIds === []){
if (selectedUserIds === []) {
await window.electronAPI.showAlert('No user selected!')
.then(() => console.log('Alert window opened'))
.catch(error => console.error('Error changing content:', error));
+1 -1
View File
@@ -1,4 +1,4 @@
document.addEventListener('DOMContentLoaded', async function() {
document.addEventListener('DOMContentLoaded', async function () {
await new Promise(resolve => setTimeout(resolve, 2000));
fadeOut('login.html');
});
+5 -5
View File
@@ -3,7 +3,7 @@ document.addEventListener('DOMContentLoaded', async function () {
const continueButton = document.getElementById('continue');
const signupDataExists = await window.electronAPI.checkFileExists('signupData.json');
if(signupDataExists){
if (signupDataExists) {
await window.electronAPI.readFile('signupData.json')
.then(result => {
const signupData = JSON.parse(result.content);
@@ -63,9 +63,9 @@ document.addEventListener('DOMContentLoaded', async function () {
await window.electronAPI.writeFile('signupData.json', JSON.stringify(formDataJSON));
fadeOut('sign_up_departments.html');
}).catch(async error => {
await window.electronAPI.showAlert(error.message)
.then(() => console.log('Alert window opened'))
.catch(error => console.error('Error changing content:', error));
})
await window.electronAPI.showAlert(error.message)
.then(() => console.log('Alert window opened'))
.catch(error => console.error('Error changing content:', error));
})
});
});