+
+
+
+

+
+
+
+
+
+
+
+
+ Start your 7-Day free trial of Bitwarden for {{ org }}
+
+
+
+
+
+
+
+
+
+
+
+
+ This is content of "Step 3"
+
+
+
+
+
+ This is any content of "Step 4"
+
+
+
-
-
-
-
-
-
-
-
-
-
- This is content of "Step 3"
-
-
-
-
-
- This is any content of "Step 4"
-
-
-
diff --git a/apps/web/src/app/modules/trial-initiation/trial-initiation.component.ts b/apps/web/src/app/modules/trial-initiation/trial-initiation.component.ts
index 0e6772ff3d2..188cf857cbd 100644
--- a/apps/web/src/app/modules/trial-initiation/trial-initiation.component.ts
+++ b/apps/web/src/app/modules/trial-initiation/trial-initiation.component.ts
@@ -5,6 +5,15 @@ import { FormBuilder, Validators } from "@angular/forms";
import { ActivatedRoute } from "@angular/router";
import { first } from "rxjs";
+import { ApiService } from "@bitwarden/common/abstractions/api.service";
+import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
+import { LogService } from "@bitwarden/common/abstractions/log.service";
+import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
+import { StateService } from "@bitwarden/common/abstractions/state.service";
+import { PolicyData } from "@bitwarden/common/models/data/policyData";
+import { MasterPasswordPolicyOptions } from "@bitwarden/common/models/domain/masterPasswordPolicyOptions";
+import { Policy } from "@bitwarden/common/models/domain/policy";
+
import { VerticalStepperComponent } from "../vertical-stepper/vertical-stepper.component";
@Component({
@@ -15,6 +24,9 @@ export class TrialInitiationComponent implements OnInit {
email = "";
org = "teams";
orgInfoSubLabel = "";
+ accountCreateOnly = true;
+ policies: Policy[];
+ enforcedPolicyOptions: MasterPasswordPolicyOptions;
@ViewChild("stepper", { static: true }) verticalStepper: VerticalStepperComponent;
orgInfoFormGroup = this.formBuilder.group({
@@ -29,18 +41,48 @@ export class TrialInitiationComponent implements OnInit {
constructor(
private route: ActivatedRoute,
private formBuilder: FormBuilder,
- private titleCasePipe: TitleCasePipe
+ private titleCasePipe: TitleCasePipe,
+ private stateService: StateService,
+ private apiService: ApiService,
+ private logService: LogService,
+ private policyService: PolicyService,
+ private i18nService: I18nService
) {}
- ngOnInit(): void {
+ async ngOnInit(): Promise
{
this.route.queryParams.pipe(first()).subscribe((qParams) => {
if (qParams.email != null && qParams.email.indexOf("@") > -1) {
this.email = qParams.email;
}
if (qParams.org) {
this.org = qParams.org;
+ this.accountCreateOnly = false;
}
});
+
+ const invite = await this.stateService.getOrganizationInvitation();
+ if (invite != null) {
+ try {
+ const policies = await this.apiService.getPoliciesByToken(
+ invite.organizationId,
+ invite.token,
+ invite.email,
+ invite.organizationUserId
+ );
+ if (policies.data != null) {
+ const policiesData = policies.data.map((p) => new PolicyData(p));
+ this.policies = policiesData.map((p) => new Policy(p));
+ }
+ } catch (e) {
+ this.logService.error(e);
+ }
+ }
+
+ if (this.policies != null) {
+ this.enforcedPolicyOptions = await this.policyService.getMasterPasswordPolicyOptions(
+ this.policies
+ );
+ }
}
stepSelectionChange(event: StepperSelectionEvent) {
diff --git a/apps/web/src/app/oss-routing.module.ts b/apps/web/src/app/oss-routing.module.ts
index 76501a16f49..f2cde10f2e1 100644
--- a/apps/web/src/app/oss-routing.module.ts
+++ b/apps/web/src/app/oss-routing.module.ts
@@ -63,16 +63,10 @@ const routes: Routes = [
{ path: "2fa", component: TwoFactorComponent, canActivate: [UnauthGuard] },
{
path: "register",
- component: RegisterComponent,
+ component: flagEnabled("showTrial") ? TrialInitiationComponent : RegisterComponent,
canActivate: [UnauthGuard],
data: { titleId: "createAccount" },
},
- buildFlaggedRoute("showTrial", {
- path: "trial",
- component: TrialInitiationComponent,
- canActivate: [UnauthGuard],
- data: { titleId: "startTrial" },
- }),
{
path: "sso",
component: SsoComponent,