Skip to content

Commit

Permalink
fix: when grace period is over select the enrollment type based on ce…
Browse files Browse the repository at this point in the history
…rtificate availability (#16599) (#16601)

Co-authored-by: Arjita <arjitamitra3@gmail.com>
  • Loading branch information
github-actions[bot] and arjita-mitra committed Jan 23, 2024
1 parent de0bf40 commit 2a00d42
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/script/E2EIdentity/E2EIdentityEnrollment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ export class E2EIHandler extends TypedEventEmitter<Events> {
gracePeriodInMs,
timer: new SnoozableTimer({
gracePeriodInMS: gracePeriodInMs,
onGracePeriodExpired: () => this.startEnrollment(ModalType.ENROLL),
onSnoozeExpired: () => this.startEnrollment(ModalType.ENROLL),
onGracePeriodExpired: () => this.processEnrollmentUponExpiry(),
onSnoozeExpired: () => this.processEnrollmentUponExpiry(),
}),
};

Expand All @@ -138,6 +138,12 @@ export class E2EIHandler extends TypedEventEmitter<Events> {
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<void> {
const hasCertificate = await hasActiveCertificate();
if (hasCertificate) {
Expand Down

0 comments on commit 2a00d42

Please sign in to comment.