1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 00:33:44 +00:00

Auth/PM-12613 - Registration with Email Verification - Provider Invite Flow (#11635)

* PM-12613 - AcceptProviderComp - Add support for new registration with email verification flow.

* PM-12613 - AcceptProviderComp - Reduce required params for finish registration to minimum

* PM-12613 - RegistrationFinish - Add passthrough logic for provider invite token

* PM-12613 - Update DefaultRegistrationFinishService finishRegistration tests to assert that all web only inputs are undefined on the outgoing request model

* PM-12613 - DefaultRegistrationFinishService - finishRegistration - Add missed mapping of optional properties into buildRegisterRequest

* PM-12613 - WebRegistrationFinishService - Add tests for additional token flows.
This commit is contained in:
Jared Snider
2024-10-24 17:21:06 -04:00
committed by GitHub
parent a0fe4f4ca6
commit 1fb1be56b3
9 changed files with 227 additions and 11 deletions

View File

@@ -28,14 +28,8 @@
>
{{ "logIn" | i18n }}
</a>
<a
bitButton
buttonType="primary"
[routerLink]="registerRoute$ | async"
[queryParams]="{ email: email }"
[block]="true"
>
<button type="button" bitButton buttonType="primary" (click)="register()" [block]="true">
{{ "createAccount" | i18n }}
</a>
</button>
</div>
</div>

View File

@@ -1,5 +1,6 @@
import { Component } from "@angular/core";
import { ActivatedRoute, Params, Router } from "@angular/router";
import { firstValueFrom } from "rxjs";
import { RegisterRouteService } from "@bitwarden/auth/common";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
@@ -15,6 +16,9 @@ import { BaseAcceptComponent } from "@bitwarden/web-vault/app/common/base.accept
})
export class AcceptProviderComponent extends BaseAcceptComponent {
providerName: string;
providerId: string;
providerUserId: string;
providerInviteToken: string;
failedMessage = "providerInviteAcceptFailed";
@@ -52,5 +56,31 @@ export class AcceptProviderComponent extends BaseAcceptComponent {
async unauthedHandler(qParams: Params) {
this.providerName = qParams.providerName;
this.providerId = qParams.providerId;
this.providerUserId = qParams.providerUserId;
this.providerInviteToken = qParams.token;
}
async register() {
let queryParams: Params;
let registerRoute = await firstValueFrom(this.registerRoute$);
if (registerRoute === "/register") {
queryParams = {
email: this.email,
};
} else if (registerRoute === "/signup") {
// We have to override the base component route as we don't need users to
// complete email verification if they are coming directly an emailed invite.
registerRoute = "/finish-signup";
queryParams = {
email: this.email,
providerUserId: this.providerUserId,
providerInviteToken: this.providerInviteToken,
};
}
await this.router.navigate([registerRoute], {
queryParams: queryParams,
});
}
}