diff --git a/web/src/admin/crypto/CertificateKeyPairListPage.ts b/web/src/admin/crypto/CertificateKeyPairListPage.ts index ad0f066a1..911f0069a 100644 --- a/web/src/admin/crypto/CertificateKeyPairListPage.ts +++ b/web/src/admin/crypto/CertificateKeyPairListPage.ts @@ -95,17 +95,25 @@ export class CertificateKeyPairListPage extends TablePage { if (item.managed && item.managed.startsWith("goauthentik.io/crypto/discovered")) { managedSubText = t`Managed by authentik (Discovered)`; } + let color = PFColor.Green; + if (item.certExpiry) { + const now = new Date(); + const inAMonth = new Date(); + inAMonth.setDate(inAMonth.getDate() + 30); + if (item.certExpiry <= inAMonth) { + color = PFColor.Orange; + } + if (item.certExpiry <= now) { + color = PFColor.Red; + } + } return [ html`
${item.name}
${item.managed ? html`${managedSubText}` : html``}`, html` ${item.privateKeyAvailable ? t`Yes (${item.privateKeyType?.toUpperCase()})` : t`No`} `, - html` new Date() ? PFColor.Green : PFColor.Orange} - > - ${item.certExpiry?.toLocaleString()} - `, + html` ${item.certExpiry?.toLocaleString()} `, html` ${t`Update`} ${t`Update Certificate-Key Pair`}