mirror of
https://github.com/bitwarden/browser
synced 2025-12-10 21:33:27 +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:
@@ -113,8 +113,14 @@ describe("DefaultRegistrationFinishService", () => {
|
||||
kdfIterations: passwordInputResult.kdfConfig.iterations,
|
||||
kdfMemory: undefined,
|
||||
kdfParallelism: undefined,
|
||||
orgInviteToken: undefined, // OrgInvite only handled in web
|
||||
organizationUserId: undefined, // OrgInvite only handled in web
|
||||
// Web only fields should be undefined
|
||||
orgInviteToken: undefined,
|
||||
organizationUserId: undefined,
|
||||
orgSponsoredFreeFamilyPlanToken: undefined,
|
||||
acceptEmergencyAccessInviteToken: undefined,
|
||||
acceptEmergencyAccessId: undefined,
|
||||
providerInviteToken: undefined,
|
||||
providerUserId: undefined,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -30,6 +30,8 @@ export class DefaultRegistrationFinishService implements RegistrationFinishServi
|
||||
orgSponsoredFreeFamilyPlanToken?: string,
|
||||
acceptEmergencyAccessInviteToken?: string,
|
||||
emergencyAccessId?: string,
|
||||
providerInviteToken?: string,
|
||||
providerUserId?: string,
|
||||
): Promise<string> {
|
||||
const [newUserKey, newEncUserKey] = await this.keyService.makeUserKey(
|
||||
passwordInputResult.masterKey,
|
||||
@@ -49,6 +51,8 @@ export class DefaultRegistrationFinishService implements RegistrationFinishServi
|
||||
orgSponsoredFreeFamilyPlanToken,
|
||||
acceptEmergencyAccessInviteToken,
|
||||
emergencyAccessId,
|
||||
providerInviteToken,
|
||||
providerUserId,
|
||||
);
|
||||
|
||||
const capchaBypassToken = await this.accountApiService.registerFinish(registerRequest);
|
||||
@@ -65,6 +69,8 @@ export class DefaultRegistrationFinishService implements RegistrationFinishServi
|
||||
orgSponsoredFreeFamilyPlanToken?: string, // web only
|
||||
acceptEmergencyAccessInviteToken?: string, // web only
|
||||
emergencyAccessId?: string, // web only
|
||||
providerInviteToken?: string, // web only
|
||||
providerUserId?: string, // web only
|
||||
): Promise<RegisterFinishRequest> {
|
||||
const userAsymmetricKeysRequest = new KeysRequest(
|
||||
userAsymmetricKeys[0],
|
||||
|
||||
@@ -49,6 +49,10 @@ export class RegistrationFinishComponent implements OnInit, OnDestroy {
|
||||
acceptEmergencyAccessInviteToken: string;
|
||||
emergencyAccessId: string;
|
||||
|
||||
// This token is provided when the user is coming from an emailed invite to accept a provider invite
|
||||
providerInviteToken: string;
|
||||
providerUserId: string;
|
||||
|
||||
masterPasswordPolicyOptions: MasterPasswordPolicyOptions | null = null;
|
||||
|
||||
constructor(
|
||||
@@ -104,6 +108,11 @@ export class RegistrationFinishComponent implements OnInit, OnDestroy {
|
||||
this.acceptEmergencyAccessInviteToken = qParams.acceptEmergencyAccessInviteToken;
|
||||
this.emergencyAccessId = qParams.emergencyAccessId;
|
||||
}
|
||||
|
||||
if (qParams.providerInviteToken != null && qParams.providerUserId != null) {
|
||||
this.providerInviteToken = qParams.providerInviteToken;
|
||||
this.providerUserId = qParams.providerUserId;
|
||||
}
|
||||
}
|
||||
|
||||
private async initOrgInviteFlowIfPresent(): Promise<boolean> {
|
||||
@@ -140,6 +149,8 @@ export class RegistrationFinishComponent implements OnInit, OnDestroy {
|
||||
this.orgSponsoredFreeFamilyPlanToken,
|
||||
this.acceptEmergencyAccessInviteToken,
|
||||
this.emergencyAccessId,
|
||||
this.providerInviteToken,
|
||||
this.providerUserId,
|
||||
);
|
||||
} catch (e) {
|
||||
this.validationService.showError(e);
|
||||
|
||||
@@ -25,6 +25,8 @@ export abstract class RegistrationFinishService {
|
||||
* @param orgSponsoredFreeFamilyPlanToken The optional org sponsored free family plan token.
|
||||
* @param acceptEmergencyAccessInviteToken The optional accept emergency access invite token.
|
||||
* @param emergencyAccessId The optional emergency access id which is required to validate the emergency access invite token.
|
||||
* @param providerInviteToken The optional provider invite token.
|
||||
* @param providerUserId The optional provider user id which is required to validate the provider invite token.
|
||||
* @returns a promise which resolves to the captcha bypass token string upon a successful account creation.
|
||||
*/
|
||||
abstract finishRegistration(
|
||||
@@ -34,5 +36,7 @@ export abstract class RegistrationFinishService {
|
||||
orgSponsoredFreeFamilyPlanToken?: string,
|
||||
acceptEmergencyAccessInviteToken?: string,
|
||||
emergencyAccessId?: string,
|
||||
providerInviteToken?: string,
|
||||
providerUserId?: string,
|
||||
): Promise<string>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user