diff --git a/src/script/E2EIdentity/E2EIdentityEnrollment.ts b/src/script/E2EIdentity/E2EIdentityEnrollment.ts index 865e0988a3c..c8b79b926dd 100644 --- a/src/script/E2EIdentity/E2EIdentityEnrollment.ts +++ b/src/script/E2EIdentity/E2EIdentityEnrollment.ts @@ -128,8 +128,8 @@ export class E2EIHandler extends TypedEventEmitter { gracePeriodInMs, timer: new SnoozableTimer({ gracePeriodInMS: gracePeriodInMs, - onGracePeriodExpired: () => this.startEnrollment(ModalType.ENROLL), - onSnoozeExpired: () => this.startEnrollment(ModalType.ENROLL), + onGracePeriodExpired: () => this.processEnrollmentUponExpiry(), + onSnoozeExpired: () => this.processEnrollmentUponExpiry(), }), }; @@ -138,6 +138,12 @@ export class E2EIHandler extends TypedEventEmitter { return this; } + private async processEnrollmentUponExpiry() { + const hasCertificate = await hasActiveCertificate(); + const enrollmentType = hasCertificate ? ModalType.CERTIFICATE_RENEWAL : ModalType.ENROLL; + await this.startEnrollment(enrollmentType); + } + public async attemptEnrollment(): Promise { const hasCertificate = await hasActiveCertificate(); if (hasCertificate) {