mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 23:33:31 +00:00
[AC-1046] activate autofill on page load policy (#4860)
* [EC-1046] add activate autofill policy to web * [EC-1046] add local setting if policy needs to be set * [AC-1046] activate autofill on page load if flag exists * [AC-1046] move activation to current tab page * [AC-1046] add warning to autofill policy * [AC-1046] add useActivateAutofillPolicy to organization reponse * [AC-1046] autofill to auto-fill
This commit is contained in:
@@ -358,7 +358,13 @@ export abstract class StateService<T extends Account = Account> {
|
||||
|
||||
getAvatarColor: (options?: StorageOptions) => Promise<string | null | undefined>;
|
||||
setAvatarColor: (value: string, options?: StorageOptions) => Promise<void>;
|
||||
|
||||
getActivateAutoFillOnPageLoadFromPolicy: (
|
||||
options?: StorageOptions
|
||||
) => Promise<boolean | undefined>;
|
||||
setActivateAutoFillOnPageLoadFromPolicy: (
|
||||
value: boolean,
|
||||
options?: StorageOptions
|
||||
) => Promise<void>;
|
||||
getSMOnboardingTasks: (
|
||||
options?: StorageOptions
|
||||
) => Promise<Record<string, Record<string, boolean>>>;
|
||||
|
||||
@@ -10,4 +10,5 @@ export enum PolicyType {
|
||||
ResetPassword = 8, // Allows orgs to use reset password : also can enable auto-enrollment during invite flow
|
||||
MaximumVaultTimeout = 9, // Sets the maximum allowed vault timeout
|
||||
DisablePersonalVaultExport = 10, // Disable personal vault export
|
||||
ActivateAutofill = 11, // Activates autofill with page load on the browser extension
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ export class OrganizationData {
|
||||
useCustomPermissions: boolean;
|
||||
useResetPassword: boolean;
|
||||
useSecretsManager: boolean;
|
||||
useActivateAutofillPolicy: boolean;
|
||||
selfHost: boolean;
|
||||
usersGetPremium: boolean;
|
||||
seats: number;
|
||||
@@ -66,6 +67,7 @@ export class OrganizationData {
|
||||
this.useCustomPermissions = response.useCustomPermissions;
|
||||
this.useResetPassword = response.useResetPassword;
|
||||
this.useSecretsManager = response.useSecretsManager;
|
||||
this.useActivateAutofillPolicy = response.useActivateAutofillPolicy;
|
||||
this.selfHost = response.selfHost;
|
||||
this.usersGetPremium = response.usersGetPremium;
|
||||
this.seats = response.seats;
|
||||
|
||||
@@ -238,6 +238,7 @@ export class AccountSettings {
|
||||
serverConfig?: ServerConfigData;
|
||||
approveLoginRequests?: boolean;
|
||||
avatarColor?: string;
|
||||
activateAutoFillOnPageLoadFromPolicy?: boolean;
|
||||
smOnboardingTasks?: Record<string, Record<string, boolean>>;
|
||||
|
||||
static fromJSON(obj: Jsonify<AccountSettings>): AccountSettings {
|
||||
|
||||
@@ -25,6 +25,7 @@ export class Organization {
|
||||
useCustomPermissions: boolean;
|
||||
useResetPassword: boolean;
|
||||
useSecretsManager: boolean;
|
||||
useActivateAutofillPolicy: boolean;
|
||||
selfHost: boolean;
|
||||
usersGetPremium: boolean;
|
||||
seats: number;
|
||||
@@ -72,6 +73,7 @@ export class Organization {
|
||||
this.useCustomPermissions = obj.useCustomPermissions;
|
||||
this.useResetPassword = obj.useResetPassword;
|
||||
this.useSecretsManager = obj.useSecretsManager;
|
||||
this.useActivateAutofillPolicy = obj.useActivateAutofillPolicy;
|
||||
this.selfHost = obj.selfHost;
|
||||
this.usersGetPremium = obj.usersGetPremium;
|
||||
this.seats = obj.seats;
|
||||
|
||||
@@ -21,6 +21,7 @@ export class ProfileOrganizationResponse extends BaseResponse {
|
||||
useCustomPermissions: boolean;
|
||||
useResetPassword: boolean;
|
||||
useSecretsManager: boolean;
|
||||
useActivateAutofillPolicy: boolean;
|
||||
selfHost: boolean;
|
||||
usersGetPremium: boolean;
|
||||
seats: number;
|
||||
@@ -65,6 +66,7 @@ export class ProfileOrganizationResponse extends BaseResponse {
|
||||
this.useCustomPermissions = this.getResponseProperty("UseCustomPermissions") ?? false;
|
||||
this.useResetPassword = this.getResponseProperty("UseResetPassword");
|
||||
this.useSecretsManager = this.getResponseProperty("UseSecretsManager");
|
||||
this.useActivateAutofillPolicy = this.getResponseProperty("UseActivateAutofillPolicy");
|
||||
this.selfHost = this.getResponseProperty("SelfHost");
|
||||
this.usersGetPremium = this.getResponseProperty("UsersGetPremium");
|
||||
this.seats = this.getResponseProperty("Seats");
|
||||
|
||||
@@ -21,7 +21,7 @@ export class PolicyService implements InternalPolicyServiceAbstraction {
|
||||
policies$ = this._policies.asObservable();
|
||||
|
||||
constructor(
|
||||
private stateService: StateService,
|
||||
protected stateService: StateService,
|
||||
private organizationService: OrganizationService
|
||||
) {
|
||||
this.stateService.activeAccountUnlocked$
|
||||
|
||||
@@ -2365,6 +2365,26 @@ export class StateService<
|
||||
);
|
||||
}
|
||||
|
||||
async getActivateAutoFillOnPageLoadFromPolicy(options?: StorageOptions): Promise<boolean> {
|
||||
return (
|
||||
await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()))
|
||||
)?.settings?.activateAutoFillOnPageLoadFromPolicy;
|
||||
}
|
||||
|
||||
async setActivateAutoFillOnPageLoadFromPolicy(
|
||||
value: boolean,
|
||||
options?: StorageOptions
|
||||
): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, await this.defaultOnDiskLocalOptions())
|
||||
);
|
||||
account.settings.activateAutoFillOnPageLoadFromPolicy = value;
|
||||
return await this.saveAccount(
|
||||
account,
|
||||
this.reconcileOptions(options, await this.defaultOnDiskLocalOptions())
|
||||
);
|
||||
}
|
||||
|
||||
async getSMOnboardingTasks(
|
||||
options?: StorageOptions
|
||||
): Promise<Record<string, Record<string, boolean>>> {
|
||||
|
||||
Reference in New Issue
Block a user