Copy TOTP after all autofills, remove old UI

This commit is contained in:
Thomas Rittson 2021-05-14 10:04:08 +10:00
parent 900e2c406c
commit af61732800
4 changed files with 1 additions and 30 deletions

View File

@ -898,12 +898,6 @@
"enableAutoFillOnPageLoadDesc": { "enableAutoFillOnPageLoadDesc": {
"message": "If a login form is detected, automatically perform an auto-fill when the web page loads." "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, the TOTP verification code is automatically copied to your clipboard after loading the web page. This is overridden by Disable Automatic TOTP Copy."
},
"experimentalFeature": { "experimentalFeature": {
"message": "This is currently an experimental feature. Use at your own risk." "message": "This is currently an experimental feature. Use at your own risk."
}, },

View File

@ -161,17 +161,5 @@
<b>{{'warning' | i18n}}</b>: {{'experimentalFeature' | i18n}} <b>{{'warning' | i18n}}</b>: {{'experimentalFeature' | i18n}}
</div> </div>
</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>
</ng-container> </ng-container>
</content> </content>

View File

@ -7,7 +7,6 @@ import { UriMatchType } from 'jslib/enums/uriMatchType';
import { I18nService } from 'jslib/abstractions/i18n.service'; import { I18nService } from 'jslib/abstractions/i18n.service';
import { MessagingService } from 'jslib/abstractions/messaging.service'; import { MessagingService } from 'jslib/abstractions/messaging.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { StateService } from 'jslib/abstractions/state.service'; import { StateService } from 'jslib/abstractions/state.service';
import { StorageService } from 'jslib/abstractions/storage.service'; import { StorageService } from 'jslib/abstractions/storage.service';
import { TotpService } from 'jslib/abstractions/totp.service'; import { TotpService } from 'jslib/abstractions/totp.service';
@ -22,7 +21,6 @@ export class OptionsComponent implements OnInit {
disableFavicon = false; disableFavicon = false;
disableBadgeCounter = false; disableBadgeCounter = false;
enableAutoFillOnPageLoad = false; enableAutoFillOnPageLoad = false;
enableAutoTotpCopyOnAutoFill = false;
disableAutoTotpCopy = false; disableAutoTotpCopy = false;
disableContextMenuItem = false; disableContextMenuItem = false;
disableAddLoginNotification = false; disableAddLoginNotification = false;
@ -72,8 +70,6 @@ export class OptionsComponent implements OnInit {
this.enableAutoFillOnPageLoad = await this.storageService.get<boolean>( this.enableAutoFillOnPageLoad = await this.storageService.get<boolean>(
ConstantsService.enableAutoFillOnPageLoadKey); ConstantsService.enableAutoFillOnPageLoadKey);
this.enableAutoTotpCopyOnAutoFill = await this.totpService.isAutoCopyOnAutoFillEnabled();
this.disableAddLoginNotification = await this.storageService.get<boolean>( this.disableAddLoginNotification = await this.storageService.get<boolean>(
ConstantsService.disableAddLoginNotificationKey); ConstantsService.disableAddLoginNotificationKey);
@ -124,10 +120,6 @@ export class OptionsComponent implements OnInit {
await this.storageService.save(ConstantsService.enableAutoFillOnPageLoadKey, this.enableAutoFillOnPageLoad); await this.storageService.save(ConstantsService.enableAutoFillOnPageLoadKey, this.enableAutoFillOnPageLoad);
} }
async updateAutoTotpCopyOnAutoFill() {
await this.storageService.save(ConstantsService.enableAutoTotpCopyOnAutoFillKey, this.enableAutoTotpCopyOnAutoFill);
}
async updateDisableFavicon() { async updateDisableFavicon() {
await this.storageService.save(ConstantsService.disableFaviconKey, this.disableFavicon); await this.storageService.save(ConstantsService.disableFaviconKey, this.disableFavicon);
await this.stateService.save(ConstantsService.disableFaviconKey, this.disableFavicon); await this.stateService.save(ConstantsService.disableFaviconKey, this.disableFavicon);

View File

@ -259,13 +259,10 @@ export default class AutofillService implements AutofillServiceInterface {
return; return;
} }
const copyTotpOnAutoFill = await this.totpService.isAutoCopyOnAutoFillEnabled();
const shouldCopyTotp = fromCommand || copyTotpOnAutoFill;
const totpCode = await this.doAutoFill({ const totpCode = await this.doAutoFill({
cipher: cipher, cipher: cipher,
pageDetails: pageDetails, pageDetails: pageDetails,
skipTotp: !shouldCopyTotp, skipTotp: false,
skipLastUsed: !fromCommand, skipLastUsed: !fromCommand,
skipUsernameOnlyFill: !fromCommand, skipUsernameOnlyFill: !fromCommand,
onlyEmptyFields: !fromCommand, onlyEmptyFields: !fromCommand,