Add reset button and functionality

This commit is contained in:
Marcel van Remmerden 2022-02-14 05:21:48 +01:00
parent 6a846e3ffd
commit 56db03f8ad
No known key found for this signature in database
GPG Key ID: 3AD81256454B7FFB
4 changed files with 26 additions and 2 deletions

View File

@ -221,7 +221,8 @@
<button onclick="chooseCertificate()" id="custom-cert-path-button">
Choose certificate file
</button>
<p class="hidden" id="custom-cert-path-text"></p>
<span class="hidden" id="custom-cert-path-text"></span>
<button class="hidden" onclick="resetCertificate()" id="custom-cert-path-reset">Reset</button>
</div>
<button
type="submit"

View File

@ -672,15 +672,33 @@ ipcMain.on('choose-certificate', () => {
mb.window.webContents.executeJavaScript(
'document.getElementById("custom-cert-path-button").classList.add("hidden")',
);
mb.window.webContents.executeJavaScript(
`document.getElementById("custom-cert-path-text").innerText="${filepath}"`,
);
mb.window.webContents.executeJavaScript(
'document.getElementById("custom-cert-path-text").classList.remove("hidden")',
);
mb.window.webContents.executeJavaScript(
`document.getElementById("custom-cert-path-text").innerText="${filepath}"`,
'document.getElementById("custom-cert-path-reset").classList.remove("hidden")',
);
}
});
ipcMain.on('reset-certificate', () => {
mb.window.webContents.executeJavaScript(
'document.getElementById("custom-cert-path-button").classList.remove("hidden")',
);
mb.window.webContents.executeJavaScript(
'document.getElementById("custom-cert-path-text").innerText=""',
);
mb.window.webContents.executeJavaScript(
'document.getElementById("custom-cert-path-text").classList.add("hidden")',
);
mb.window.webContents.executeJavaScript(
'document.getElementById("custom-cert-path-reset").classList.add("hidden")',
);
});
ipcMain.on('start-login', () => {
startLogin();
});

View File

@ -26,6 +26,7 @@ const api = {
changeKeepVisible: (value) => ipcRenderer.send('change-keep-visible', value),
changeShowDockIcon: (value) => ipcRenderer.send('change-show-dock-icon', value),
chooseCertificate: () => ipcRenderer.send('choose-certificate'),
resetCertificate: () => ipcRenderer.send('reset-certificate'),
startLogin: () => ipcRenderer.send('start-login'),
startManualLogin: (value) => ipcRenderer.send('start-manual-login', value),
logout: () => ipcRenderer.send('logout'),

View File

@ -134,6 +134,10 @@ function chooseCertificate() {
window.electron.chooseCertificate();
}
function resetCertificate() {
window.electron.resetCertificate();
}
function startLogin() {
window.electron.startLogin();
}