mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-22 11:45:59 +01:00
[PM-8144] Migrate auto-fill policy logic from Tab to new Vault component (#10450)
* little expriment with setting the auto fill policy in the background * removed unused reference * removed ng container
This commit is contained in:
parent
46ecde5d63
commit
d1c3ec4a76
@ -4170,5 +4170,8 @@
|
||||
},
|
||||
"systemDefault": {
|
||||
"message": "System default"
|
||||
},
|
||||
"enterprisePolicyRequirementsApplied": {
|
||||
"message": "Enterprise policy requirements have been applied to this setting"
|
||||
}
|
||||
}
|
||||
|
@ -145,8 +145,12 @@
|
||||
type="checkbox"
|
||||
(change)="updateAutofillOnPageLoad()"
|
||||
[(ngModel)]="enableAutofillOnPageLoad"
|
||||
[disabled]="autofillOnPageLoadFromPolicy$ | async"
|
||||
/>
|
||||
<bit-label for="autofillOnPageLoad">{{ "enableAutoFillOnPageLoad" | i18n }}</bit-label>
|
||||
<bit-hint class="tw-text-sm" *ngIf="autofillOnPageLoadFromPolicy$ | async">{{
|
||||
"enterprisePolicyRequirementsApplied" | i18n
|
||||
}}</bit-hint>
|
||||
</bit-form-control>
|
||||
<bit-form-field disableMargin>
|
||||
<bit-label for="defaultAutofill">{{ "defaultAutoFillOnPageLoad" | i18n }}</bit-label>
|
||||
|
@ -87,6 +87,9 @@ export class AutofillComponent implements OnInit {
|
||||
DisablePasswordManagerUris.Unknown;
|
||||
protected browserShortcutsURI: BrowserShortcutsUri = BrowserShortcutsUris.Unknown;
|
||||
protected browserClientIsUnknown: boolean;
|
||||
protected autofillOnPageLoadFromPolicy$ =
|
||||
this.autofillSettingsService.activateAutofillOnPageLoadFromPolicy$;
|
||||
|
||||
enableAutofillOnPageLoad = false;
|
||||
enableInlineMenu = false;
|
||||
enableInlineMenuOnIconSelect = false;
|
||||
|
@ -81,5 +81,6 @@ export abstract class AutofillService {
|
||||
fromCommand: boolean,
|
||||
cipherType?: CipherType,
|
||||
) => Promise<string | null>;
|
||||
setAutoFillOnPageLoadOrgPolicy: () => Promise<void>;
|
||||
isPasswordRepromptRequired: (cipher: CipherView, tab: chrome.tabs.Tab) => Promise<boolean>;
|
||||
}
|
||||
|
@ -570,6 +570,19 @@ export default class AutofillService implements AutofillServiceInterface {
|
||||
return totpCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Activates the autofill on page load org policy.
|
||||
*/
|
||||
async setAutoFillOnPageLoadOrgPolicy(): Promise<void> {
|
||||
const autofillOnPageLoadOrgPolicy = await firstValueFrom(
|
||||
this.autofillSettingsService.activateAutofillOnPageLoadFromPolicy$,
|
||||
);
|
||||
|
||||
if (autofillOnPageLoadOrgPolicy) {
|
||||
await this.autofillSettingsService.setAutofillOnPageLoad(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the active tab from the current window.
|
||||
* Throws an error if no tab is found.
|
||||
|
@ -228,7 +228,7 @@ export default class RuntimeBackground {
|
||||
// `getAllDecryptedForUrl` and is anticipated to be refactored
|
||||
await this.main.refreshBadge();
|
||||
await this.main.refreshMenu(false);
|
||||
|
||||
await this.autofillService.setAutoFillOnPageLoadOrgPolicy();
|
||||
break;
|
||||
}
|
||||
case "addToLockedVaultPendingNotifications":
|
||||
@ -248,6 +248,7 @@ export default class RuntimeBackground {
|
||||
}, 2000);
|
||||
await this.configService.ensureConfigFetched();
|
||||
await this.main.updateOverlayCiphers();
|
||||
await this.autofillService.setAutoFillOnPageLoadOrgPolicy();
|
||||
}
|
||||
break;
|
||||
case "openPopup":
|
||||
|
@ -146,9 +146,8 @@ export class AutofillSettingsService implements AutofillSettingsServiceAbstracti
|
||||
this.autofillOnPageLoadPolicyToastHasDisplayedState = this.stateProvider.getActive(
|
||||
AUTOFILL_ON_PAGE_LOAD_POLICY_TOAST_HAS_DISPLAYED,
|
||||
);
|
||||
this.autofillOnPageLoadPolicyToastHasDisplayed$ = this.autofillOnPageLoadState.state$.pipe(
|
||||
map((x) => x ?? false),
|
||||
);
|
||||
this.autofillOnPageLoadPolicyToastHasDisplayed$ =
|
||||
this.autofillOnPageLoadPolicyToastHasDisplayedState.state$.pipe(map((x) => x ?? false));
|
||||
|
||||
this.autoCopyTotpState = this.stateProvider.getActive(AUTO_COPY_TOTP);
|
||||
this.autoCopyTotp$ = this.autoCopyTotpState.state$.pipe(map((x) => x ?? true));
|
||||
|
Loading…
Reference in New Issue
Block a user