added email verification
This commit is contained in:
+11
-11
@@ -18,12 +18,12 @@ document.addEventListener('DOMContentLoaded', async function () {
|
||||
const step1 = document.getElementById('step1');
|
||||
const step2 = document.getElementById('step2');
|
||||
|
||||
if (!await window.electronAPI.openUcSocket()) {
|
||||
if (!await window.networkAPI.openUcSocket()) {
|
||||
alert('Internal error of the application.');
|
||||
return;
|
||||
}
|
||||
|
||||
const operationCodes = await window.electronAPI.getOperationsCodes();
|
||||
const operationCodes = await window.networkAPI.getOperationsCodes();
|
||||
if (!operationCodes) {
|
||||
await window.electronAPI.showAlert('Internal error of the application.');
|
||||
return;
|
||||
@@ -35,7 +35,7 @@ document.addEventListener('DOMContentLoaded', async function () {
|
||||
|
||||
let departments = await getDepartments();
|
||||
if (departments === null) {
|
||||
await window.electronAPI.showAlert('Failed to fetch departments.');
|
||||
await window.uiAPI.showAlert('Failed to fetch departments.');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ document.addEventListener('DOMContentLoaded', async function () {
|
||||
userData.email = document.querySelector('input[name="email"]').value;
|
||||
userData.name = document.querySelector('input[name="name"]').value;
|
||||
userData.password = document.querySelector('input[name="password"]').value;
|
||||
userData.app_type = await window.electronAPI.readUserConfig('app_type');
|
||||
userData.app_type = await window.databaseAPI.getAppType();
|
||||
|
||||
// Move to Step 2
|
||||
const departmentList = document.getElementById('departmentList');
|
||||
@@ -75,7 +75,7 @@ document.addEventListener('DOMContentLoaded', async function () {
|
||||
// Get the selected department
|
||||
userData.departmentId = document.querySelector('input[name="dept"]:checked')?.value;
|
||||
if (!userData.departmentId) {
|
||||
await window.electronAPI.showAlert('Please select a department.');
|
||||
await window.uiAPI.showAlert('Please select a department.');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -84,8 +84,8 @@ document.addEventListener('DOMContentLoaded', async function () {
|
||||
return;
|
||||
}
|
||||
|
||||
await window.electronAPI.showAlert('Signup successful!');
|
||||
await window.electronAPI.changeContent('login');
|
||||
await window.uiAPI.showAlert('Signup successful!');
|
||||
await window.uiAPI.changeContent('login');
|
||||
});
|
||||
|
||||
// Back to Step 1 from Step 2
|
||||
@@ -96,8 +96,8 @@ document.addEventListener('DOMContentLoaded', async function () {
|
||||
// Back to login
|
||||
backToLogin.addEventListener('click', async function (e) {
|
||||
e.preventDefault();
|
||||
await window.electronAPI.closeUcSocket();
|
||||
await window.electronAPI.changeContent('login');
|
||||
await window.networkAPI.closeUcSocket();
|
||||
await window.uiAPI.changeContent('login');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -113,13 +113,13 @@ async function getDepartments() {
|
||||
}
|
||||
|
||||
async function attemptSignUp() {
|
||||
if (!await window.electronAPI.sendUcMessage(codeSignUp, userData)) return false;
|
||||
if (!await window.networkAPI.sendUcMessage(codeSignUp, userData)) return false;
|
||||
|
||||
const response = await waitForResponse();
|
||||
if (response && response.operationCode === codeOk) {
|
||||
return true;
|
||||
}
|
||||
await window.electronAPI.showAlert(`Signup failed: ${response?.metaInfo?.message || 'Unknown error'}`);
|
||||
await window.uiAPI.showAlert(`Signup failed: ${response?.metaInfo?.message || 'Unknown error'}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user