diff --git a/.changeset/cuddly-jeans-hope.md b/.changeset/cuddly-jeans-hope.md new file mode 100644 index 00000000000..fe5fc096ed8 --- /dev/null +++ b/.changeset/cuddly-jeans-hope.md @@ -0,0 +1,6 @@ +--- +"@wso2is/admin.server-configurations.v1": patch +"@wso2is/console": patch +--- + +Support the feature indefinitely lock user until admin unlocks diff --git a/apps/console/src/extensions/i18n/models/extensions.ts b/apps/console/src/extensions/i18n/models/extensions.ts index 175cd2e66f2..9933b7527ae 100755 --- a/apps/console/src/extensions/i18n/models/extensions.ts +++ b/apps/console/src/extensions/i18n/models/extensions.ts @@ -3145,6 +3145,7 @@ export interface Extensions { form: { fields: { accountLockIncrementFactor: FormAttributes; + enableIndefiniteUserLockduration: FormAttributes; accountLockTime: FormAttributes; enable: FormAttributes; maxFailedAttempts: FormAttributes; diff --git a/apps/console/src/extensions/i18n/resources/en-US/extensions.ts b/apps/console/src/extensions/i18n/resources/en-US/extensions.ts index 4ac3b773006..584087ab808 100755 --- a/apps/console/src/extensions/i18n/resources/en-US/extensions.ts +++ b/apps/console/src/extensions/i18n/resources/en-US/extensions.ts @@ -3773,6 +3773,12 @@ export const extensions: Extensions = { "with 1 or 2 digits." } }, + enableIndefiniteUserLockduration: { + hint: + "The account will be locked indefinitely after max failed attempts until the account " + + "is manually unlocked by an admin", + label: "Enable indefinite user lock duration" + }, accountLockTime: { hint: "This specifies the initial duration that the account will be locked for. " + diff --git a/features/admin.server-configurations.v1/forms/login-attempt-security-form.tsx b/features/admin.server-configurations.v1/forms/login-attempt-security-form.tsx index 38d94806040..ec56aac00ff 100644 --- a/features/admin.server-configurations.v1/forms/login-attempt-security-form.tsx +++ b/features/admin.server-configurations.v1/forms/login-attempt-security-form.tsx @@ -146,6 +146,7 @@ export const LoginAttemptSecurityConfigurationFrom: FunctionComponent< const [ lockDuration, setLockDuration ] = useState(undefined); const [ lockIncrementRatio, setLockIncrementRatio ] = useState(undefined); const [ notifyUserOnAccountLockIncrement, setNotifyUserOnAccountLockIncrement ] = useState(undefined); + const [ enableIndefiniteUserLockduration, setEnableIndefiniteUserLockduration ] = useState(undefined); const [ accordionActiveIndex, setAccordionActiveIndex ] = useState(undefined); /** @@ -173,6 +174,7 @@ export const LoginAttemptSecurityConfigurationFrom: FunctionComponent< accountLockTime: property.value }; setLockDuration(property.value); + setEnableIndefiniteUserLockduration(parseInt(property.value) === 0); } else if (property.name === ServerConfigurationsConstants.ACCOUNT_LOCK_TIME_INCREMENT_FACTOR) { resolvedInitialValues = { ...resolvedInitialValues, @@ -269,8 +271,9 @@ export const LoginAttemptSecurityConfigurationFrom: FunctionComponent< // Check for invalid input. errors.accountLockTime = t("extensions:manage.serverConfigurations.accountSecurity." + "loginAttemptSecurity.form.fields.accountLockTime.validations.invalid"); - } else if ((parseInt(values.accountLockTime, 10) < GovernanceConnectorConstants - .LOGINS_ATTEMPT_SECURITY_FORM_FIELD_CONSTRAINTS.ACCOUNT_LOCK_TIME_MIN_VALUE) + } else if (((parseInt(values.accountLockTime, 10) < GovernanceConnectorConstants + .LOGINS_ATTEMPT_SECURITY_FORM_FIELD_CONSTRAINTS.ACCOUNT_LOCK_TIME_MIN_VALUE) && + !enableIndefiniteUserLockduration) || (parseInt(values.accountLockTime, 10) > GovernanceConnectorConstants .LOGINS_ATTEMPT_SECURITY_FORM_FIELD_CONSTRAINTS.ACCOUNT_LOCK_TIME_MAX_VALUE)) { // Check for invalid range. @@ -325,6 +328,11 @@ export const LoginAttemptSecurityConfigurationFrom: FunctionComponent< setAccordionActiveIndex(newIndex); }; + const updateEnableIndefiniteAccountLockDuration = (value: any) => { + setEnableIndefiniteUserLockduration(value); + setLockDuration("0"); + }; + /** * Renders sample info section with example configuration details. * @@ -472,6 +480,25 @@ export const LoginAttemptSecurityConfigurationFrom: FunctionComponent< "loginAttemptSecurity.form.fields.maxFailedAttempts.hint") } + updateEnableIndefiniteAccountLockDuration(value) } + checked={ enableIndefiniteUserLockduration } + required={ false } + readOnly={ readOnly } + disabled={ !isConnectorEnabled } + width={ 10 } + data-testid={ `${testId}-enable-indefinite-user-lock-duration` } + /> + + { + t("extensions:manage.serverConfigurations.accountSecurity." + + "loginAttemptSecurity.form.fields.enableIndefiniteUserLockduration.hint") + } +