mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 00:33:44 +00:00
copy totp from each implementation of autofill
This commit is contained in:
@@ -147,7 +147,7 @@ export default class MainBackground {
|
||||
this.passwordGenerationService = new PasswordGenerationService(this.cryptoService, this.storageService);
|
||||
this.totpService = new TotpService(this.storageService, cryptoFunctionService);
|
||||
this.autofillService = new AutofillService(this.cipherService, this.tokenService,
|
||||
this.totpService, this.utilsService, this.platformUtilsService);
|
||||
this.totpService);
|
||||
this.containerService = new ContainerService(this.cryptoService, this.platformUtilsService);
|
||||
this.auditService = new AuditService(cryptoFunctionService);
|
||||
this.analytics = new Analytics(window, () => BrowserApi.gaFilter(), this.platformUtilsService,
|
||||
|
||||
@@ -136,11 +136,15 @@ export default class RuntimeBackground {
|
||||
break;
|
||||
case 'autofiller':
|
||||
case 'autofill_cmd':
|
||||
await this.autofillService.doAutoFillForLastUsedLogin([{
|
||||
const totpCode = await this.autofillService.doAutoFillForLastUsedLogin([{
|
||||
frameId: sender.frameId,
|
||||
tab: msg.tab,
|
||||
details: msg.details,
|
||||
}], msg.sender === 'autofill_cmd');
|
||||
|
||||
if (totpCode !== null && !this.platformUtilsService.isFirefox()) {
|
||||
this.platformUtilsService.copyToClipboard(totpCode);
|
||||
}
|
||||
break;
|
||||
case 'contextMenu':
|
||||
clearTimeout(this.autofillTimeout);
|
||||
@@ -161,12 +165,15 @@ export default class RuntimeBackground {
|
||||
}
|
||||
|
||||
private async autofillPage() {
|
||||
await this.autofillService.doAutoFill({
|
||||
const totpCode = await this.autofillService.doAutoFill({
|
||||
cipher: this.main.loginToAutoFill,
|
||||
pageDetails: this.pageDetailsToAutoFill,
|
||||
fromBackground: true,
|
||||
});
|
||||
|
||||
if (totpCode !== null && !this.platformUtilsService.isFirefox()) {
|
||||
this.platformUtilsService.copyToClipboard(totpCode);
|
||||
}
|
||||
|
||||
// reset
|
||||
this.main.loginToAutoFill = null;
|
||||
this.pageDetailsToAutoFill = [];
|
||||
|
||||
Reference in New Issue
Block a user