program finalizat
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
let codeResetPassword = '';
|
||||
let codeOk = '';
|
||||
|
||||
document.addEventListener('DOMContentLoaded', async function () {
|
||||
const backToLoginButton = document.getElementById('backToLogin');
|
||||
const resetPasswordButton = document.getElementById('resetPassword');
|
||||
@@ -9,8 +12,8 @@ document.addEventListener('DOMContentLoaded', async function () {
|
||||
return;
|
||||
}
|
||||
|
||||
const codeResetPassword = operationCodes.RESET_PASSWORD;
|
||||
const codeOk = operationCodes.OK;
|
||||
codeResetPassword = operationCodes.RESET_PASSWORD;
|
||||
codeOk = operationCodes.OK;
|
||||
|
||||
// Back to login
|
||||
backToLoginButton.addEventListener('click', function (e) {
|
||||
@@ -45,19 +48,19 @@ document.addEventListener('DOMContentLoaded', async function () {
|
||||
await window.electronAPI.showAlert('Password reset successfully.');
|
||||
window.electronAPI.changeContent('login');
|
||||
});
|
||||
|
||||
async function attemptResetPassword(email, newPassword) {
|
||||
const app_type = await window.electronAPI.readUserConfig('app_type');
|
||||
const messageData = { email, newPassword, app_type };
|
||||
|
||||
if (!await window.electronAPI.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.');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
async function attemptResetPassword(email, newPassword) {
|
||||
const app_type = await window.electronAPI.readUserConfig('app_type');
|
||||
const messageData = { email, newPassword, app_type };
|
||||
|
||||
if (!await window.electronAPI.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.');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user