Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: when grace period is over select the enrolment type based on certificate availability #16599

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading