Merge pull request #2317 from bitwarden/Bug/AccountSwitching/QABugBonanza
[bug] Fix several regression bugs
This commit is contained in:
commit
f9851285d5
2
jslib
2
jslib
|
@ -1 +1 @@
|
||||||
Subproject commit 448856cc22510086bfddc99e3f1022ee28727694
|
Subproject commit e0cc754d6fe962a5e7eae6d1dead8b44606d4853
|
|
@ -3,9 +3,18 @@ document.addEventListener("DOMContentLoaded", (event) => {
|
||||||
let filledThisHref = false;
|
let filledThisHref = false;
|
||||||
let delayFillTimeout: number;
|
let delayFillTimeout: number;
|
||||||
|
|
||||||
const enabledKey = "enableAutoFillOnPageLoad";
|
const activeUserIdKey = "activeUserId";
|
||||||
chrome.storage.local.get(enabledKey, (obj: any) => {
|
let activeUserId: string;
|
||||||
if (obj != null && obj[enabledKey] === true) {
|
|
||||||
|
chrome.storage.local.get(activeUserIdKey, (obj: any) => {
|
||||||
|
if (obj == null || obj[activeUserIdKey] == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
activeUserId = obj[activeUserIdKey];
|
||||||
|
});
|
||||||
|
|
||||||
|
chrome.storage.local.get(activeUserId, (obj: any) => {
|
||||||
|
if (obj != null && obj[activeUserId].settings.enableAutoFillOnPageLoad === true) {
|
||||||
setInterval(() => doFillIfNeeded(), 500);
|
setInterval(() => doFillIfNeeded(), 500);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -26,6 +26,7 @@ import { routerTransition } from "./app-routing.animations";
|
||||||
})
|
})
|
||||||
export class AppComponent implements OnInit {
|
export class AppComponent implements OnInit {
|
||||||
private lastActivity: number = null;
|
private lastActivity: number = null;
|
||||||
|
private activeUserId: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private toastrService: ToastrService,
|
private toastrService: ToastrService,
|
||||||
|
@ -46,19 +47,16 @@ export class AppComponent implements OnInit {
|
||||||
if (BrowserApi.getBackgroundPage() == null) {
|
if (BrowserApi.getBackgroundPage() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let activeUserId: string = null;
|
|
||||||
this.stateService.activeAccount.subscribe((userId) => {
|
this.stateService.activeAccount.subscribe((userId) => {
|
||||||
activeUserId = userId;
|
this.activeUserId = userId;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.ngZone.runOutsideAngular(() => {
|
this.ngZone.runOutsideAngular(() => {
|
||||||
if (activeUserId != null) {
|
window.onmousedown = () => this.recordActivity();
|
||||||
window.onmousedown = () => this.recordActivity(activeUserId);
|
window.ontouchstart = () => this.recordActivity();
|
||||||
window.ontouchstart = () => this.recordActivity(activeUserId);
|
window.onclick = () => this.recordActivity();
|
||||||
window.onclick = () => this.recordActivity(activeUserId);
|
window.onscroll = () => this.recordActivity();
|
||||||
window.onscroll = () => this.recordActivity(activeUserId);
|
window.onkeypress = () => this.recordActivity();
|
||||||
window.onkeypress = () => this.recordActivity(activeUserId);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
(window as any).bitwardenPopupMainMessageListener = async (
|
(window as any).bitwardenPopupMainMessageListener = async (
|
||||||
|
@ -171,14 +169,18 @@ export class AppComponent implements OnInit {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async recordActivity(userId: string) {
|
private async recordActivity() {
|
||||||
|
if (this.activeUserId == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const now = new Date().getTime();
|
const now = new Date().getTime();
|
||||||
if (this.lastActivity != null && now - this.lastActivity < 250) {
|
if (this.lastActivity != null && now - this.lastActivity < 250) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.lastActivity = now;
|
this.lastActivity = now;
|
||||||
this.stateService.setLastActive(now, { userId: userId });
|
await this.stateService.setLastActive(now, { userId: this.activeUserId });
|
||||||
}
|
}
|
||||||
|
|
||||||
private showToast(msg: any) {
|
private showToast(msg: any) {
|
||||||
|
|
|
@ -104,8 +104,8 @@ export class SettingsComponent implements OnInit {
|
||||||
this.vaultTimeout.setValue(timeout);
|
this.vaultTimeout.setValue(timeout);
|
||||||
}
|
}
|
||||||
this.previousVaultTimeout = this.vaultTimeout.value;
|
this.previousVaultTimeout = this.vaultTimeout.value;
|
||||||
this.vaultTimeout.valueChanges.subscribe((value) => {
|
this.vaultTimeout.valueChanges.subscribe(async (value) => {
|
||||||
this.saveVaultTimeout(value);
|
await this.saveVaultTimeout(value);
|
||||||
});
|
});
|
||||||
|
|
||||||
const action = await this.stateService.getVaultTimeoutAction();
|
const action = await this.stateService.getVaultTimeoutAction();
|
||||||
|
|
Loading…
Reference in New Issue