mirror of
https://github.com/bitwarden/browser
synced 2026-01-06 02:23:44 +00:00
[PM-22179] Redirect user to /setup-extension (#15375)
* add end user feature flag * add initial setup extension component and route * redirect users from registration completion to the setup extension page * add `hideIcon` to anon layout for web - matches implementation on the browser. * integrate with anon layout for extension wrapper * add initial loading state * conditionally redirect the user upon initialization * redirect the user to the vault if the extension is installed * add initial copy for setup-extension page * add confirmation dialog for skipping the extension installation * add success state for setup extension page * only show loggedin toast when end user activation is not enabled. * add image alt * lower threshold for polling extension * close the dialog when linking to the vault * update party colors * use the platform specific registration service to to only forward the web registrations to `/setup-extension` * call `super` rather than `/vault` directly, it could change in the future
This commit is contained in:
@@ -9,6 +9,7 @@ import { PolicyService } from "@bitwarden/common/admin-console/abstractions/poli
|
||||
import { MasterPasswordPolicyOptions } from "@bitwarden/common/admin-console/models/domain/master-password-policy-options";
|
||||
import { Policy } from "@bitwarden/common/admin-console/models/domain/policy";
|
||||
import { AccountApiService } from "@bitwarden/common/auth/abstractions/account-api.service";
|
||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
||||
import { EncString } from "@bitwarden/common/platform/models/domain/enc-string";
|
||||
@@ -33,6 +34,7 @@ describe("WebRegistrationFinishService", () => {
|
||||
let policyApiService: MockProxy<PolicyApiServiceAbstraction>;
|
||||
let logService: MockProxy<LogService>;
|
||||
let policyService: MockProxy<PolicyService>;
|
||||
let configService: MockProxy<ConfigService>;
|
||||
const mockUserId = Utils.newGuid() as UserId;
|
||||
let accountService: FakeAccountService;
|
||||
|
||||
@@ -44,6 +46,7 @@ describe("WebRegistrationFinishService", () => {
|
||||
logService = mock<LogService>();
|
||||
policyService = mock<PolicyService>();
|
||||
accountService = mockAccountServiceWith(mockUserId);
|
||||
configService = mock<ConfigService>();
|
||||
|
||||
service = new WebRegistrationFinishService(
|
||||
keyService,
|
||||
@@ -53,6 +56,7 @@ describe("WebRegistrationFinishService", () => {
|
||||
logService,
|
||||
policyService,
|
||||
accountService,
|
||||
configService,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -418,4 +422,22 @@ describe("WebRegistrationFinishService", () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("determineLoginSuccessRoute", () => {
|
||||
it("returns /setup-extension when the end user activation feature flag is enabled", async () => {
|
||||
configService.getFeatureFlag.mockResolvedValue(true);
|
||||
|
||||
const result = await service.determineLoginSuccessRoute();
|
||||
|
||||
expect(result).toBe("/setup-extension");
|
||||
});
|
||||
|
||||
it("returns /vault when the end user activation feature flag is disabled", async () => {
|
||||
configService.getFeatureFlag.mockResolvedValue(false);
|
||||
|
||||
const result = await service.determineLoginSuccessRoute();
|
||||
|
||||
expect(result).toBe("/vault");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,6 +14,8 @@ import { Policy } from "@bitwarden/common/admin-console/models/domain/policy";
|
||||
import { AccountApiService } from "@bitwarden/common/auth/abstractions/account-api.service";
|
||||
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
||||
import { RegisterFinishRequest } from "@bitwarden/common/auth/models/request/registration/register-finish.request";
|
||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||
import { EncryptedString, EncString } from "@bitwarden/common/platform/models/domain/enc-string";
|
||||
import { KeyService } from "@bitwarden/key-management";
|
||||
@@ -32,6 +34,7 @@ export class WebRegistrationFinishService
|
||||
private logService: LogService,
|
||||
private policyService: PolicyService,
|
||||
private accountService: AccountService,
|
||||
private configService: ConfigService,
|
||||
) {
|
||||
super(keyService, accountApiService);
|
||||
}
|
||||
@@ -76,6 +79,18 @@ export class WebRegistrationFinishService
|
||||
return masterPasswordPolicyOpts;
|
||||
}
|
||||
|
||||
override async determineLoginSuccessRoute(): Promise<string> {
|
||||
const endUserActivationFlagEnabled = await this.configService.getFeatureFlag(
|
||||
FeatureFlag.PM19315EndUserActivationMvp,
|
||||
);
|
||||
|
||||
if (endUserActivationFlagEnabled) {
|
||||
return "/setup-extension";
|
||||
} else {
|
||||
return super.determineLoginSuccessRoute();
|
||||
}
|
||||
}
|
||||
|
||||
// Note: the org invite token and email verification are mutually exclusive. Only one will be present.
|
||||
override async buildRegisterRequest(
|
||||
email: string,
|
||||
|
||||
Reference in New Issue
Block a user