mirror of
https://github.com/bitwarden/browser.git
synced 2025-03-02 03:41:09 +01:00
Merge pull request #1626 from tomershvueli/copy-totp-on-auto-fill
feat: Add option to auto-copy TOTP code when page auto fills credentials
This commit is contained in:
commit
f1680e9da1
2
jslib
2
jslib
@ -1 +1 @@
|
||||
Subproject commit a72c8a60c1b7a6980bceee456c53a9ea7b9b3451
|
||||
Subproject commit 2841cff90a8ff8136b5d580443725be792521bea
|
@ -898,6 +898,12 @@
|
||||
"enableAutoFillOnPageLoadDesc": {
|
||||
"message": "If a login form is detected, automatically perform an auto-fill when the web page loads."
|
||||
},
|
||||
"enableAutoTotpCopyOnAutoFill": {
|
||||
"message": "Automatic TOTP Copy after Page Load"
|
||||
},
|
||||
"enableAutoTotpCopyOnAutoFillDesc": {
|
||||
"message": "If Auto-fill On Page Load is enabled, and your login has an authenticator key attached to it, the TOTP verification code is automatically copied to your clipboard after loading the web page."
|
||||
},
|
||||
"experimentalFeature": {
|
||||
"message": "This is currently an experimental feature. Use at your own risk."
|
||||
},
|
||||
|
@ -24,6 +24,18 @@
|
||||
<b>{{'warning' | i18n}}</b>: {{'experimentalFeature' | i18n}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="box">
|
||||
<div class="box-content">
|
||||
<div class="box-content-row box-content-row-checkbox" appBoxRow>
|
||||
<label for="autoCopyTotp">{{'enableAutoTotpCopyOnAutoFill' | i18n}}</label>
|
||||
<input id="autoCopyTotp" type="checkbox" (change)="updateAutoTotpCopyOnAutoFill()"
|
||||
[(ngModel)]="enableAutoTotpCopyOnAutoFill" [disabled]="!enableAutoFillOnPageLoad">
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
{{'enableAutoTotpCopyOnAutoFillDesc' | i18n}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="box">
|
||||
<div class="box-content">
|
||||
<div class="box-content-row" appBoxRow>
|
||||
|
@ -22,6 +22,7 @@ export class OptionsComponent implements OnInit {
|
||||
disableFavicon = false;
|
||||
disableBadgeCounter = false;
|
||||
enableAutoFillOnPageLoad = false;
|
||||
enableAutoTotpCopyOnAutoFill = false;
|
||||
disableAutoTotpCopy = false;
|
||||
disableContextMenuItem = false;
|
||||
disableAddLoginNotification = false;
|
||||
@ -68,6 +69,8 @@ export class OptionsComponent implements OnInit {
|
||||
this.enableAutoFillOnPageLoad = await this.storageService.get<boolean>(
|
||||
ConstantsService.enableAutoFillOnPageLoadKey);
|
||||
|
||||
this.enableAutoTotpCopyOnAutoFill = await this.totpService.isAutoCopyOnAutoFillEnabled();
|
||||
|
||||
this.disableAddLoginNotification = await this.storageService.get<boolean>(
|
||||
ConstantsService.disableAddLoginNotificationKey);
|
||||
|
||||
@ -118,6 +121,10 @@ export class OptionsComponent implements OnInit {
|
||||
await this.storageService.save(ConstantsService.enableAutoFillOnPageLoadKey, this.enableAutoFillOnPageLoad);
|
||||
}
|
||||
|
||||
async updateAutoTotpCopyOnAutoFill() {
|
||||
await this.storageService.save(ConstantsService.enableAutoTotpCopyOnAutoFillKey, this.enableAutoTotpCopyOnAutoFill);
|
||||
}
|
||||
|
||||
async updateDisableFavicon() {
|
||||
await this.storageService.save(ConstantsService.disableFaviconKey, this.disableFavicon);
|
||||
await this.stateService.save(ConstantsService.disableFaviconKey, this.disableFavicon);
|
||||
|
@ -258,11 +258,14 @@ export default class AutofillService implements AutofillServiceInterface {
|
||||
if (cipher.reprompt !== CipherRepromptType.None) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const copyTotpOnAutoFill = await this.totpService.isAutoCopyOnAutoFillEnabled();
|
||||
const shouldCopyTotp = fromCommand || copyTotpOnAutoFill;
|
||||
|
||||
const totpCode = await this.doAutoFill({
|
||||
cipher: cipher,
|
||||
pageDetails: pageDetails,
|
||||
skipTotp: !fromCommand,
|
||||
skipTotp: !shouldCopyTotp,
|
||||
skipLastUsed: !fromCommand,
|
||||
skipUsernameOnlyFill: !fromCommand,
|
||||
onlyEmptyFields: !fromCommand,
|
||||
|
Loading…
Reference in New Issue
Block a user