Skip to content

Commit dabff03

Browse files
committed
🗑️ Removed Keystore & keytar. Election is remembering session between uses
1 parent 486b6ee commit dabff03

File tree

6 files changed

+33
-284
lines changed

6 files changed

+33
-284
lines changed

‎.vscode/settings.json

+1-8
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,8 @@
2424
"Dominik",
2525
"doubleclick",
2626
"hideothers",
27+
"Invitebutton",
2728
"keychain",
28-
"keystorename",
29-
"keytar",
30-
"loginbutton",
31-
"loginform",
32-
"loginkeys",
33-
"loginpassword",
34-
"loginsubmitted",
35-
"loginusername",
3629
"Nuxt",
3730
"Omnibutton",
3831
"Schmitt",

‎README.md

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ See [electron-builder](https://github.com/electron-userland/electron-builder) in
5454
- [electron](https://www.electronjs.org/)
5555
- [electron-builder](https://www.electron.build/)
5656
- [electron-updater](https://www.electron.build/auto-update)
57-
- [keytar](https://atom.github.io/node-keytar/) Node module to manage system keychain
5857
- [electron-store](https://github.com/sindresorhus/electron-store#readme)
5958
- [electron-context-menu](https://github.com/sindresorhus/electron-context-menu#readme)
6059
- [Biome Rules](https://biomejs.dev/linter/rules/)

‎browser.cjs

-57
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
const { ipcRenderer } = require('electron');
22

3-
const keyStore = import('./src/keystore.js');
4-
53
ipcRenderer.on('new-task', () => {
64
document.querySelector('.Omnibutton').click();
75
document.querySelector('.Omnibutton-task').click();
@@ -11,58 +9,3 @@ ipcRenderer.on('show-preferences', () => {
119
document.querySelector('.TopbarSettingsMenuButton')?.click();
1210
document.querySelector('.TopbarSettingsMenu-settings')?.click();
1311
});
14-
15-
document.addEventListener('readystatechange', async () => {
16-
const DomHooks = {
17-
loginform: '.LoginEmailPasswordForm',
18-
loginusername: 'input[name=e]',
19-
loginpassword: 'input[name=p]',
20-
loginbutton: '[role=button]',
21-
};
22-
23-
if (document.location.pathname.endsWith('/login')) {
24-
const loginform = document.querySelector(DomHooks.loginform);
25-
const loginusername = loginform.querySelector(DomHooks.loginusername);
26-
const loginpassword = loginform.querySelector(DomHooks.loginpassword);
27-
28-
// try using saved login
29-
const loginkeys = await keyStore.getKey();
30-
31-
// Trigger the attached `change` event to get the values into the Virtual DOM (as Asana runs React/Nuxt.js)
32-
const event = new Event('HTMLEvents');
33-
event.initEvent('change', true, false);
34-
35-
if (loginkeys?.username) {
36-
loginusername.value = loginkeys.username;
37-
loginusername.dispatchEvent(event);
38-
}
39-
40-
if (loginkeys?.password) {
41-
loginpassword.value = loginkeys.password;
42-
loginpassword.dispatchEvent(event);
43-
}
44-
45-
const loginsubmitted = async () => {
46-
const username = loginusername.value;
47-
const password = loginpassword.value;
48-
49-
if (username && password) {
50-
await keyStore.deleteKeys(); // delete any exiting logins
51-
await keyStore.addKey(username, password); // store the users details for auto-login next time
52-
}
53-
};
54-
55-
// add a listener to the form to capture login details and store them
56-
// would be nice to add to just the <FORM> submit event, but React/Nuxt (used by Asana) captures the events lower in the DOM
57-
// loginform.addEventListener('submit', loginsubmitted);
58-
loginform
59-
.querySelector(DomHooks.loginbutton)
60-
.addEventListener('click', loginsubmitted);
61-
loginusername.addEventListener('keyup', (e) => {
62-
if (e.code === 'Enter') loginsubmitted();
63-
});
64-
loginpassword.addEventListener('keyup', (e) => {
65-
if (e.code === 'Enter') loginsubmitted();
66-
});
67-
}
68-
});

0 commit comments

Comments
 (0)