mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
Auth/PM-11969 - Registration with Email Verification - Accept Emergency Access Invite Flow (#11018)
* PM-11969 - Registration with Email Verification - Accept Emergency Access Invite Fixed * PM-11969 - Fix PR feedback * PM-11969 - AcceptEmergencyComponent - remove prop
This commit is contained in:
@@ -24,6 +24,8 @@ export class DefaultRegistrationFinishService implements RegistrationFinishServi
|
||||
passwordInputResult: PasswordInputResult,
|
||||
emailVerificationToken?: string,
|
||||
orgSponsoredFreeFamilyPlanToken?: string,
|
||||
acceptEmergencyAccessInviteToken?: string,
|
||||
emergencyAccessId?: string,
|
||||
): Promise<string> {
|
||||
const [newUserKey, newEncUserKey] = await this.cryptoService.makeUserKey(
|
||||
passwordInputResult.masterKey,
|
||||
@@ -41,6 +43,8 @@ export class DefaultRegistrationFinishService implements RegistrationFinishServi
|
||||
userAsymmetricKeys,
|
||||
emailVerificationToken,
|
||||
orgSponsoredFreeFamilyPlanToken,
|
||||
acceptEmergencyAccessInviteToken,
|
||||
emergencyAccessId,
|
||||
);
|
||||
|
||||
const capchaBypassToken = await this.accountApiService.registerFinish(registerRequest);
|
||||
@@ -55,6 +59,8 @@ export class DefaultRegistrationFinishService implements RegistrationFinishServi
|
||||
userAsymmetricKeys: [string, EncString],
|
||||
emailVerificationToken?: string,
|
||||
orgSponsoredFreeFamilyPlanToken?: string, // web only
|
||||
acceptEmergencyAccessInviteToken?: string, // web only
|
||||
emergencyAccessId?: string, // web only
|
||||
): Promise<RegisterFinishRequest> {
|
||||
const userAsymmetricKeysRequest = new KeysRequest(
|
||||
userAsymmetricKeys[0],
|
||||
|
||||
@@ -44,6 +44,10 @@ export class RegistrationFinishComponent implements OnInit, OnDestroy {
|
||||
// setup a free family plan sponsored by an organization but they don't have an account yet.
|
||||
orgSponsoredFreeFamilyPlanToken: string;
|
||||
|
||||
// this token is provided when the user is coming from an emailed invite to accept an emergency access invite
|
||||
acceptEmergencyAccessInviteToken: string;
|
||||
emergencyAccessId: string;
|
||||
|
||||
masterPasswordPolicyOptions: MasterPasswordPolicyOptions | null = null;
|
||||
|
||||
constructor(
|
||||
@@ -79,6 +83,11 @@ export class RegistrationFinishComponent implements OnInit, OnDestroy {
|
||||
if (qParams.orgSponsoredFreeFamilyPlanToken != null) {
|
||||
this.orgSponsoredFreeFamilyPlanToken = qParams.orgSponsoredFreeFamilyPlanToken;
|
||||
}
|
||||
|
||||
if (qParams.acceptEmergencyAccessInviteToken != null && qParams.emergencyAccessId) {
|
||||
this.acceptEmergencyAccessInviteToken = qParams.acceptEmergencyAccessInviteToken;
|
||||
this.emergencyAccessId = qParams.emergencyAccessId;
|
||||
}
|
||||
}),
|
||||
switchMap((qParams: Params) => {
|
||||
if (
|
||||
@@ -111,6 +120,8 @@ export class RegistrationFinishComponent implements OnInit, OnDestroy {
|
||||
passwordInputResult,
|
||||
this.emailVerificationToken,
|
||||
this.orgSponsoredFreeFamilyPlanToken,
|
||||
this.acceptEmergencyAccessInviteToken,
|
||||
this.emergencyAccessId,
|
||||
);
|
||||
} catch (e) {
|
||||
this.validationService.showError(e);
|
||||
|
||||
@@ -16,6 +16,8 @@ export abstract class RegistrationFinishService {
|
||||
* @param passwordInputResult The password input result.
|
||||
* @param emailVerificationToken The optional email verification token. Not present in emailed invite scenarios (ex: org invite).
|
||||
* @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.
|
||||
* Returns a promise which resolves to the captcha bypass token string upon a successful account creation.
|
||||
*/
|
||||
abstract finishRegistration(
|
||||
@@ -23,5 +25,7 @@ export abstract class RegistrationFinishService {
|
||||
passwordInputResult: PasswordInputResult,
|
||||
emailVerificationToken?: string,
|
||||
orgSponsoredFreeFamilyPlanToken?: string,
|
||||
acceptEmergencyAccessInviteToken?: string,
|
||||
emergencyAccessId?: string,
|
||||
): Promise<string>;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ export class RegisterFinishRequest {
|
||||
|
||||
public emailVerificationToken?: string,
|
||||
public orgSponsoredFreeFamilyPlanToken?: string,
|
||||
public acceptEmergencyAccessInviteToken?: string,
|
||||
public acceptEmergencyAccessId?: string,
|
||||
|
||||
// Org Invite data (only applies on web)
|
||||
public organizationUserId?: string,
|
||||
|
||||
Reference in New Issue
Block a user