mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 23:33:31 +00:00
Merge pull request #1455 from eliykat/feature-aopl-options
"Auto-fill on page load" options
This commit is contained in:
2
jslib
2
jslib
Submodule jslib updated: 8659d0975d...3d4ecaeb6a
@@ -901,6 +901,24 @@
|
|||||||
"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."
|
||||||
},
|
},
|
||||||
|
"defaultAutoFillOnPageLoad": {
|
||||||
|
"message": "Default autofill setting for login items"
|
||||||
|
},
|
||||||
|
"defaultAutoFillOnPageLoadDesc": {
|
||||||
|
"message": "After enabling Auto-fill On Page Load, you can enable or disable the feature for individual login items. This is the default setting for login items that are not separately configured."
|
||||||
|
},
|
||||||
|
"itemAutoFillOnPageLoad": {
|
||||||
|
"message": "Auto-fill On Page Load (if enabled in Options)"
|
||||||
|
},
|
||||||
|
"autoFillOnPageLoadUseDefault": {
|
||||||
|
"message": "Use default setting"
|
||||||
|
},
|
||||||
|
"autoFillOnPageLoadYes": {
|
||||||
|
"message": "Auto-fill on page load"
|
||||||
|
},
|
||||||
|
"autoFillOnPageLoadNo": {
|
||||||
|
"message": "Do not auto-fill on page load"
|
||||||
|
},
|
||||||
"commandOpenPopup": {
|
"commandOpenPopup": {
|
||||||
"message": "Open vault popup"
|
"message": "Open vault popup"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -161,5 +161,17 @@
|
|||||||
<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" appBoxRow>
|
||||||
|
<label for="defaultAutofill">{{'defaultAutoFillOnPageLoad' | i18n}}</label>
|
||||||
|
<select id="defaultAutofill" name="DefaultAutofill" [(ngModel)]="autoFillOnPageLoadDefault"
|
||||||
|
(change)="updateAutoFillOnPageLoadDefault()" [disabled]="!enableAutoFillOnPageLoad">
|
||||||
|
<option *ngFor="let o of autoFillOnPageLoadOptions" [ngValue]="o.value">{{o.name}}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="box-footer">{{'defaultAutoFillOnPageLoadDesc' | i18n}}</div>
|
||||||
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</content>
|
</content>
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ export class OptionsComponent implements OnInit {
|
|||||||
disableFavicon = false;
|
disableFavicon = false;
|
||||||
disableBadgeCounter = false;
|
disableBadgeCounter = false;
|
||||||
enableAutoFillOnPageLoad = false;
|
enableAutoFillOnPageLoad = false;
|
||||||
|
autoFillOnPageLoadDefault = false;
|
||||||
|
autoFillOnPageLoadOptions: any[];
|
||||||
disableAutoTotpCopy = false;
|
disableAutoTotpCopy = false;
|
||||||
disableContextMenuItem = false;
|
disableContextMenuItem = false;
|
||||||
disableAddLoginNotification = false;
|
disableAddLoginNotification = false;
|
||||||
@@ -64,11 +66,18 @@ export class OptionsComponent implements OnInit {
|
|||||||
{ name: i18nService.t('twoMinutes'), value: 120 },
|
{ name: i18nService.t('twoMinutes'), value: 120 },
|
||||||
{ name: i18nService.t('fiveMinutes'), value: 300 },
|
{ name: i18nService.t('fiveMinutes'), value: 300 },
|
||||||
];
|
];
|
||||||
|
this.autoFillOnPageLoadOptions = [
|
||||||
|
{ name: i18nService.t('autoFillOnPageLoadYes'), value: true },
|
||||||
|
{ name: i18nService.t('autoFillOnPageLoadNo'), value: false },
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.enableAutoFillOnPageLoad = await this.storageService.get<boolean>(
|
this.enableAutoFillOnPageLoad = await this.storageService.get<boolean>(
|
||||||
ConstantsService.enableAutoFillOnPageLoadKey);
|
ConstantsService.enableAutoFillOnPageLoadKey);
|
||||||
|
|
||||||
|
this.autoFillOnPageLoadDefault = await this.storageService.get<boolean>(
|
||||||
|
ConstantsService.autoFillOnPageLoadDefaultKey) ?? false;
|
||||||
|
|
||||||
this.disableAddLoginNotification = await this.storageService.get<boolean>(
|
this.disableAddLoginNotification = await this.storageService.get<boolean>(
|
||||||
ConstantsService.disableAddLoginNotificationKey);
|
ConstantsService.disableAddLoginNotificationKey);
|
||||||
@@ -120,6 +129,10 @@ export class OptionsComponent implements OnInit {
|
|||||||
await this.storageService.save(ConstantsService.enableAutoFillOnPageLoadKey, this.enableAutoFillOnPageLoad);
|
await this.storageService.save(ConstantsService.enableAutoFillOnPageLoadKey, this.enableAutoFillOnPageLoad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async updateAutoFillOnPageLoadDefault() {
|
||||||
|
await this.storageService.save(ConstantsService.autoFillOnPageLoadDefaultKey, this.autoFillOnPageLoadDefault);
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|||||||
@@ -268,6 +268,16 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="box" *ngIf="showAutoFillOnPageLoadOptions">
|
||||||
|
<div class="box-content">
|
||||||
|
<div class="box-content-row" appBoxRow>
|
||||||
|
<label for="autofillOnPageLoad">{{'itemAutoFillOnPageLoad' | i18n}} </label>
|
||||||
|
<select id="autofillOnPageLoad" name="AutofillOnPageLoad" [(ngModel)]="cipher.login.autofillOnPageLoad">
|
||||||
|
<option *ngFor="let o of autofillOnPageLoadOptions" [ngValue]="o.value">{{o.name}}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<div class="box-content">
|
<div class="box-content">
|
||||||
<div class="box-content-row" appBoxRow>
|
<div class="box-content-row" appBoxRow>
|
||||||
|
|||||||
@@ -18,13 +18,17 @@ import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
|||||||
import { PolicyService } from 'jslib/abstractions/policy.service';
|
import { PolicyService } from 'jslib/abstractions/policy.service';
|
||||||
import { StateService } from 'jslib/abstractions/state.service';
|
import { StateService } from 'jslib/abstractions/state.service';
|
||||||
import { UserService } from 'jslib/abstractions/user.service';
|
import { UserService } from 'jslib/abstractions/user.service';
|
||||||
|
import { StorageService } from 'jslib/abstractions/storage.service';
|
||||||
|
|
||||||
import { PopupUtilsService } from '../services/popup-utils.service';
|
import { PopupUtilsService } from '../services/popup-utils.service';
|
||||||
|
import { ConstantsService } from 'jslib/services/constants.service';
|
||||||
|
|
||||||
import { LoginUriView } from 'jslib/models/view/loginUriView';
|
import { LoginUriView } from 'jslib/models/view/loginUriView';
|
||||||
|
|
||||||
import { AddEditComponent as BaseAddEditComponent } from 'jslib/angular/components/add-edit.component';
|
import { AddEditComponent as BaseAddEditComponent } from 'jslib/angular/components/add-edit.component';
|
||||||
|
|
||||||
|
import { CipherType } from 'jslib/enums/cipherType';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-vault-add-edit',
|
selector: 'app-vault-add-edit',
|
||||||
templateUrl: 'add-edit.component.html',
|
templateUrl: 'add-edit.component.html',
|
||||||
@@ -33,6 +37,7 @@ export class AddEditComponent extends BaseAddEditComponent {
|
|||||||
currentUris: string[];
|
currentUris: string[];
|
||||||
showAttachments = true;
|
showAttachments = true;
|
||||||
openAttachmentsInPopup: boolean;
|
openAttachmentsInPopup: boolean;
|
||||||
|
showAutoFillOnPageLoadOptions: boolean;
|
||||||
|
|
||||||
constructor(cipherService: CipherService, folderService: FolderService,
|
constructor(cipherService: CipherService, folderService: FolderService,
|
||||||
i18nService: I18nService, platformUtilsService: PlatformUtilsService,
|
i18nService: I18nService, platformUtilsService: PlatformUtilsService,
|
||||||
@@ -41,7 +46,7 @@ export class AddEditComponent extends BaseAddEditComponent {
|
|||||||
messagingService: MessagingService, private route: ActivatedRoute,
|
messagingService: MessagingService, private route: ActivatedRoute,
|
||||||
private router: Router, private location: Location,
|
private router: Router, private location: Location,
|
||||||
eventService: EventService, policyService: PolicyService,
|
eventService: EventService, policyService: PolicyService,
|
||||||
private popupUtilsService: PopupUtilsService) {
|
private popupUtilsService: PopupUtilsService, private storageService: StorageService) {
|
||||||
super(cipherService, folderService, i18nService, platformUtilsService, auditService, stateService,
|
super(cipherService, folderService, i18nService, platformUtilsService, auditService, stateService,
|
||||||
userService, collectionService, messagingService, eventService, policyService);
|
userService, collectionService, messagingService, eventService, policyService);
|
||||||
}
|
}
|
||||||
@@ -108,6 +113,12 @@ export class AddEditComponent extends BaseAddEditComponent {
|
|||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async load() {
|
||||||
|
await super.load();
|
||||||
|
this.showAutoFillOnPageLoadOptions = this.cipher.type === CipherType.Login &&
|
||||||
|
await this.storageService.get<boolean>(ConstantsService.enableAutoFillOnPageLoadKey);
|
||||||
|
}
|
||||||
|
|
||||||
async submit(): Promise<boolean> {
|
async submit(): Promise<boolean> {
|
||||||
if (await super.submit()) {
|
if (await super.submit()) {
|
||||||
if (this.cloneMode) {
|
if (this.cloneMode) {
|
||||||
|
|||||||
@@ -246,12 +246,16 @@ 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 {
|
||||||
const lastLaunchedCipher = await this.cipherService.getLastLaunchedForUrl(tab.url);
|
const lastLaunchedCipher = await this.cipherService.getLastLaunchedForUrl(tab.url, true);
|
||||||
if (lastLaunchedCipher && Date.now().valueOf() - lastLaunchedCipher.localData?.lastLaunched?.valueOf() < 30000) {
|
if (lastLaunchedCipher && Date.now().valueOf() - lastLaunchedCipher.localData?.lastLaunched?.valueOf() < 30000) {
|
||||||
cipher = lastLaunchedCipher;
|
cipher = lastLaunchedCipher;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cipher = await this.cipherService.getLastUsedForUrl(tab.url);
|
cipher = await this.cipherService.getLastUsedForUrl(tab.url, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cipher == null) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user