From 48df139c4d1e86754f5967a01618cef29b609496 Mon Sep 17 00:00:00 2001 From: Thomas Zemp Date: Thu, 30 May 2024 15:11:18 +0200 Subject: [PATCH] fix: credentialsExpiresReminderInDays [DHIS2-13866] --- src/settingsCategories.js | 1 + src/settingsFields.component.js | 3 +++ src/settingsKeyMapping.js | 15 ++++++++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/settingsCategories.js b/src/settingsCategories.js index 363b9215..774a86da 100644 --- a/src/settingsCategories.js +++ b/src/settingsCategories.js @@ -123,6 +123,7 @@ export const categories = { 'keyAllowObjectAssignment', 'credentialsExpires', 'credentialsExpiryAlert', + 'credentialsExpiresReminderInDays', 'minPasswordLength', 'corsWhitelist', 'recaptchaSite', diff --git a/src/settingsFields.component.js b/src/settingsFields.component.js index af4c8236..e20c631e 100644 --- a/src/settingsFields.component.js +++ b/src/settingsFields.component.js @@ -319,6 +319,9 @@ class SettingsFields extends React.Component { ...addConditionallyHiddenStyles(mapping), }, hintText: mapping.hintText, + type: mapping.inputType, + min: mapping.minValue, + max: mapping.maxValue, }, validators, } diff --git a/src/settingsKeyMapping.js b/src/settingsKeyMapping.js index 8517e90b..35f9938d 100644 --- a/src/settingsKeyMapping.js +++ b/src/settingsKeyMapping.js @@ -553,9 +553,22 @@ const settingsKeyMapping = { }, }, credentialsExpiryAlert: { - label: i18n.t('Enable password expiry alerts'), + label: i18n.t('Send reminders to users before their password expires'), type: 'checkbox', }, + credentialsExpiresReminderInDays: { + label: i18n.t( + 'Number of days before password expiry to send reminder (1–28)' + ), + type: 'textfield', + inputType: 'number', + minValue: 1, + maxValue: 28, + hideWhen: { + settingsKey: 'credentialsExpiryAlert', + settingsValue: 'false', + }, + }, minPasswordLength: { label: i18n.t('Minimum characters in password'), type: 'dropdown',