added email verification
This commit is contained in:
@@ -6,9 +6,9 @@ document.addEventListener('DOMContentLoaded', async function () {
|
||||
const resetPasswordButton = document.getElementById('resetPassword');
|
||||
|
||||
// Retrieve the operation codes via IPC
|
||||
const operationCodes = await window.electronAPI.getOperationsCodes();
|
||||
const operationCodes = await window.networkAPI.getOperationsCodes();
|
||||
if (!operationCodes) {
|
||||
await window.electronAPI.showAlert('Internal error of the application.');
|
||||
await window.uiAPI.showAlert('Internal error of the application.');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -18,14 +18,14 @@ document.addEventListener('DOMContentLoaded', async function () {
|
||||
// Back to login
|
||||
backToLoginButton.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
window.electronAPI.changeContent('login');
|
||||
window.uiAPI.changeContent('login');
|
||||
});
|
||||
|
||||
// Reset password logic
|
||||
resetPasswordButton.addEventListener('click', async function (e) {
|
||||
e.preventDefault();
|
||||
if (!await window.electronAPI.openUcSocket()) {
|
||||
await window.electronAPI.showAlert('Internal error of the application.');
|
||||
if (!await window.networkAPI.openUcSocket()) {
|
||||
await window.uiAPI.showAlert('Internal error of the application.');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ document.addEventListener('DOMContentLoaded', async function () {
|
||||
|
||||
// Ensure the email and new password are provided
|
||||
if (!email || !newPassword) {
|
||||
await window.electronAPI.showAlert('Please provide both email and new password.');
|
||||
await window.uiAPI.showAlert('Please provide both email and new password.');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -44,23 +44,23 @@ document.addEventListener('DOMContentLoaded', async function () {
|
||||
return;
|
||||
}
|
||||
|
||||
await window.electronAPI.closeUcSocket();
|
||||
await window.electronAPI.showAlert('Password reset successfully.');
|
||||
window.electronAPI.changeContent('login');
|
||||
await window.networkAPI.closeUcSocket();
|
||||
await window.uiAPI.showAlert('Password reset successfully.');
|
||||
await window.uiAPI.changeContent('login');
|
||||
});
|
||||
});
|
||||
|
||||
async function attemptResetPassword(email, newPassword) {
|
||||
const app_type = await window.electronAPI.readUserConfig('app_type');
|
||||
const app_type = await window.databaseAPI.getAppType();
|
||||
const messageData = { email, newPassword, app_type };
|
||||
|
||||
if (!await window.electronAPI.sendUcMessage(codeResetPassword, messageData)) return false;
|
||||
if (!await window.networkAPI.sendUcMessage(codeResetPassword, messageData)) return false;
|
||||
|
||||
const response = await waitForResponse();
|
||||
if (response && response.operationCode === codeOk) {
|
||||
return true;
|
||||
} else {
|
||||
await window.electronAPI.showAlert(response?.metaInfo?.message || 'Error resetting password.');
|
||||
await window.uiAPI.showAlert(response?.metaInfo?.message || 'Error resetting password.');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user