diff --git a/apps/web/src/app/auth/login/login.component.ts b/apps/web/src/app/auth/login/login.component.ts index 0f2ceca878..890ef713a3 100644 --- a/apps/web/src/app/auth/login/login.component.ts +++ b/apps/web/src/app/auth/login/login.component.ts @@ -108,6 +108,7 @@ export class LoginComponent extends BaseLoginComponent implements OnInit { async ngOnInit() { // eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe this.route.queryParams.pipe(first()).subscribe(async (qParams) => { + // If there is an query parameter called 'org', set previousUrl to `/create-organization?org=paramValue` if (qParams.org != null) { const route = this.router.createUrlTree(["create-organization"], { queryParams: { plan: qParams.org }, @@ -115,7 +116,11 @@ export class LoginComponent extends BaseLoginComponent implements OnInit { this.routerService.setPreviousUrl(route.toString()); } - // Are they coming from an email for sponsoring a families organization + /** + * If there is a query parameter called 'sponsorshipToken', that means they are coming + * from an email for sponsoring a families organization. If so, then set the prevousUrl + * to `/setup/families-for-enterprise?token=paramValue` + */ if (qParams.sponsorshipToken != null) { const route = this.router.createUrlTree(["setup/families-for-enterprise"], { queryParams: { token: qParams.sponsorshipToken }, diff --git a/libs/angular/src/auth/components/login.component.ts b/libs/angular/src/auth/components/login.component.ts index f94ed8aaa8..fc8c69ce75 100644 --- a/libs/angular/src/auth/components/login.component.ts +++ b/libs/angular/src/auth/components/login.component.ts @@ -103,12 +103,14 @@ export class LoginComponent extends CaptchaProtectedComponent implements OnInit, const queryParamsEmail = params.email; + // If there is an email in the query params, set that email as the form field value if (queryParamsEmail != null && queryParamsEmail.indexOf("@") > -1) { this.formGroup.controls.email.setValue(queryParamsEmail); this.paramEmailSet = true; } }); + // if there is no email in the query params, attempt to load email settings from loginEmailService if (!this.paramEmailSet) { await this.loadEmailSettings(); } diff --git a/libs/auth/src/angular/login/login.component.html b/libs/auth/src/angular/login/login.component.html index 27b11171b4..452cb2154c 100644 --- a/libs/auth/src/angular/login/login.component.html +++ b/libs/auth/src/angular/login/login.component.html @@ -1,5 +1,4 @@