1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-30 13:03:53 +01:00

Merge pull request #1428 from bitwarden/autofill-from-clicked-cipherV2

tracked last-launched ciphers for autofill
This commit is contained in:
Addison Beck 2020-10-13 15:41:50 -04:00 committed by GitHub
commit a56599fd3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 3 deletions

2
jslib

@ -1 +1 @@
Subproject commit e371d737b0d3db99f195c3317ecf9eaa16bd19b3 Subproject commit 9e9795fd855d643459a9205c5299bfbf887d4985

View File

@ -15,6 +15,7 @@ import {
import { BrowserApi } from '../../browser/browserApi'; import { BrowserApi } from '../../browser/browserApi';
import { CipherService } from 'jslib/abstractions/cipher.service';
import { CollectionService } from 'jslib/abstractions/collection.service'; import { CollectionService } from 'jslib/abstractions/collection.service';
import { FolderService } from 'jslib/abstractions/folder.service'; import { FolderService } from 'jslib/abstractions/folder.service';
import { I18nService } from 'jslib/abstractions/i18n.service'; import { I18nService } from 'jslib/abstractions/i18n.service';
@ -62,7 +63,8 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
private changeDetectorRef: ChangeDetectorRef, private stateService: StateService, private changeDetectorRef: ChangeDetectorRef, private stateService: StateService,
private popupUtils: PopupUtilsService, private i18nService: I18nService, private popupUtils: PopupUtilsService, private i18nService: I18nService,
private folderService: FolderService, private collectionService: CollectionService, private folderService: FolderService, private collectionService: CollectionService,
private analytics: Angulartics2, private platformUtilsService: PlatformUtilsService) { private analytics: Angulartics2, private platformUtilsService: PlatformUtilsService,
private cipherService: CipherService) {
super(searchService); super(searchService);
this.pageSize = 100; this.pageSize = 100;
this.applySavedState = (window as any).previousPopupUrl != null && this.applySavedState = (window as any).previousPopupUrl != null &&
@ -195,6 +197,7 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
} }
this.preventSelected = true; this.preventSelected = true;
this.analytics.eventTrack.next({ action: 'Launched URI From Listing' }); this.analytics.eventTrack.next({ action: 'Launched URI From Listing' });
await this.cipherService.updateLastLaunchedDate(cipher.id);
BrowserApi.createNewTab(cipher.login.launchUri); BrowserApi.createNewTab(cipher.login.launchUri);
if (this.popupUtils.inPopup(window)) { if (this.popupUtils.inPopup(window)) {
BrowserApi.closePopup(window); BrowserApi.closePopup(window);

View File

@ -286,6 +286,7 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit
} }
this.preventSelected = true; this.preventSelected = true;
this.analytics.eventTrack.next({ action: 'Launched URI From Listing' }); this.analytics.eventTrack.next({ action: 'Launched URI From Listing' });
await this.cipherService.updateLastLaunchedDate(cipher.id);
BrowserApi.createNewTab(cipher.login.launchUri); BrowserApi.createNewTab(cipher.login.launchUri);
if (this.popupUtils.inPopup(window)) { if (this.popupUtils.inPopup(window)) {
BrowserApi.closePopup(window); BrowserApi.closePopup(window);

View File

@ -231,7 +231,13 @@ export default class AutofillService implements AutofillServiceInterface {
if (fromCommand) { if (fromCommand) {
cipher = await this.cipherService.getNextCipherForUrl(tab.url); cipher = await this.cipherService.getNextCipherForUrl(tab.url);
} else { } else {
cipher = await this.cipherService.getLastUsedForUrl(tab.url); const lastLaunchedCipher = await this.cipherService.getLastLaunchedForUrl(tab.url);
if (lastLaunchedCipher && Date.now().valueOf() - lastLaunchedCipher.localData?.lastLaunched?.valueOf() < 30000) {
cipher = lastLaunchedCipher;
}
else {
cipher = await this.cipherService.getLastUsedForUrl(tab.url);
}
} }
const autoFillResponse = await this.doAutoFill({ const autoFillResponse = await this.doAutoFill({