mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-06 09:20:43 +01:00
fix: Nest sub option in Options page, tie auto fill & auto copy features together
This commit is contained in:
parent
72d0a439d2
commit
6eb7106bc5
@ -886,10 +886,7 @@
|
||||
"message": "If a login form is detected, automatically perform an auto-fill when the web page loads."
|
||||
},
|
||||
"enableAutoTotpCopyOnAutoFill": {
|
||||
"message": "Enable Copy to Clipboard of TOTP On Page Auto-fill"
|
||||
},
|
||||
"enableAutoTotpCopyOnAutoFillDesc": {
|
||||
"message": "If login auto-fills on page load and TOTP exists for this login, copy to clipboard without prompt"
|
||||
"message": "Enable Copy to Clipboard of TOTP"
|
||||
},
|
||||
"experimentalFeature": {
|
||||
"message": "This is currently an experimental feature. Use at your own risk."
|
||||
|
@ -9,6 +9,11 @@
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.box {
|
||||
padding-left: 15px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.box-header {
|
||||
margin: 0 10px 5px 10px;
|
||||
text-transform: uppercase;
|
||||
|
@ -23,19 +23,15 @@
|
||||
{{'enableAutoFillOnPageLoadDesc' | i18n}}
|
||||
<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="autofill">{{'enableAutoTotpCopyOnAutoFill' | i18n}}</label>
|
||||
<input id="autofill" type="checkbox" (change)="updateAutoTotpCopyOnAutoFill()"
|
||||
[(ngModel)]="enableAutoTotpCopyOnAutoFill" [disabled]="!enableAutoFillOnPageLoad">
|
||||
<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>
|
||||
<div class="box-footer">
|
||||
{{'enableAutoTotpCopyOnAutoFillDesc' | i18n}}
|
||||
<b>{{'warning' | i18n}}</b>: {{'experimentalFeature' | i18n}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="box">
|
||||
<div class="box-content">
|
||||
|
@ -123,18 +123,11 @@ export class OptionsComponent implements OnInit {
|
||||
|
||||
async updateAutoFillOnPageLoad() {
|
||||
await this.storageService.save(ConstantsService.enableAutoFillOnPageLoadKey, this.enableAutoFillOnPageLoad);
|
||||
if (!this.enableAutoFillOnPageLoad) {
|
||||
// If we disable Auto Fill on Page Load, also disable Copying of TOTP
|
||||
await this.storageService.save(ConstantsService.enableAutoTotpCopyOnAutoFill, false);
|
||||
// TODO the below reloads the entire extension, I just want to reload the current view, or at least the enable auto totp copy checkbox
|
||||
window.setTimeout(() => window.location.reload(), 200);
|
||||
}
|
||||
this.callAnalytics('Auto-fill Page Load', this.enableAutoFillOnPageLoad);
|
||||
}
|
||||
|
||||
async updateAutoTotpCopyOnAutoFill() {
|
||||
await this.storageService.save(ConstantsService.enableAutoTotpCopyOnAutoFill, this.enableAutoTotpCopyOnAutoFill);
|
||||
this.callAnalytics('Auto Copy TOTP on Page Load', this.enableAutoTotpCopyOnAutoFill);
|
||||
await this.storageService.save(ConstantsService.enableAutoTotpCopyOnAutoFillKey, this.enableAutoTotpCopyOnAutoFill);
|
||||
}
|
||||
|
||||
async updateDisableFavicon() {
|
||||
|
@ -254,12 +254,14 @@ export default class AutofillService implements AutofillServiceInterface {
|
||||
}
|
||||
}
|
||||
|
||||
const shouldCopyTotpOnAutoFill = await this.totpService.isAutoCopyOnAutoFillEnabled();
|
||||
const copyTotpOnAutoFill = await this.totpService.isAutoCopyOnAutoFillEnabled();
|
||||
const enableAutoFill = await this.totpService.isAutoCopyEnabled();
|
||||
const shouldCopyTotp = copyTotpOnAutoFill && enableAutoFill;
|
||||
|
||||
const totpCode = await this.doAutoFill({
|
||||
cipher: cipher,
|
||||
pageDetails: pageDetails,
|
||||
skipTotp: !fromCommand && !shouldCopyTotpOnAutoFill,
|
||||
skipTotp: !fromCommand && !shouldCopyTotp,
|
||||
skipLastUsed: !fromCommand,
|
||||
skipUsernameOnlyFill: !fromCommand,
|
||||
onlyEmptyFields: !fromCommand,
|
||||
|
Loading…
Reference in New Issue
Block a user