[macOS] Don't enable secure input when app is not in focus (#419)

* Don't engage macOS secure input if not focused

* Refactor to use focusInputOnPageLoad

* Refactor to remove focusInputOnPageLoad
This commit is contained in:
Thomas Rittson 2021-07-02 10:06:54 +10:00 committed by GitHub
parent 9ee31ad2fb
commit 6f6b5a5503
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -58,8 +58,8 @@ export class LoginComponent implements OnInit {
if (this.rememberEmail == null) {
this.rememberEmail = true;
}
if (Utils.isBrowser) {
document.getElementById(this.email == null || this.email === '' ? 'email' : 'masterPassword').focus();
if (Utils.isBrowser && !Utils.isNode) {
this.focusInput();
}
}
@ -143,4 +143,8 @@ export class LoginComponent implements OnInit {
'&redirectUri=' + encodeURIComponent(ssoRedirectUri) +
'&state=' + state + '&codeChallenge=' + codeChallenge);
}
protected focusInput() {
document.getElementById(this.email == null || this.email === '' ? 'email' : 'masterPassword').focus();
}
}

View File

@ -174,6 +174,12 @@ export class WindowMain {
this.win.on('move', () => {
this.windowStateChangeHandler(Keys.mainWindowSize, this.win);
});
this.win.on('focus', () => {
this.win.webContents.send('messagingService', {
command: 'windowIsFocused',
windowIsFocused: true,
});
});
if (this.createWindowCallback) {
this.createWindowCallback(this.win);