diff --git a/.changeset/hip-hairs-fry.md b/.changeset/hip-hairs-fry.md new file mode 100644 index 00000000000..1c82455ebf3 --- /dev/null +++ b/.changeset/hip-hairs-fry.md @@ -0,0 +1,7 @@ +--- +"@wso2is/admin.server-configurations.v1": patch +"@wso2is/admin.extensions.v1": patch +"@wso2is/console": patch +--- + +Add username recovery for reCaptcha toggle diff --git a/apps/console/src/extensions/i18n/models/extensions.ts b/apps/console/src/extensions/i18n/models/extensions.ts index d455a2e1c54..5b70c07d412 100755 --- a/apps/console/src/extensions/i18n/models/extensions.ts +++ b/apps/console/src/extensions/i18n/models/extensions.ts @@ -3084,6 +3084,7 @@ export interface Extensions { subSection1: string; subSection2: string; subSection3: string; + subSection4: string; }; connectorDescription: string; heading: string; 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 7c13cb21243..7b2dd9a9f16 100755 --- a/apps/console/src/extensions/i18n/resources/en-US/extensions.ts +++ b/apps/console/src/extensions/i18n/resources/en-US/extensions.ts @@ -3632,7 +3632,8 @@ export const extensions: Extensions = { heading: "This will enforce reCAPTCHA validation in respective UIs of the following flows.", subSection1: "Login to business applications", subSection2: "Recover the password of a user account", - subSection3: "Self registration for user accounts" + subSection3: "Self registration for user accounts", + subSection4: "Recover the username of a user account" }, connectorDescription: "Enable reCAPTCHA for the organization.", heading: "Bot Detection", diff --git a/features/admin.extensions.v1/configs/server-configuration.tsx b/features/admin.extensions.v1/configs/server-configuration.tsx index 04f8cd3dd29..1035b6df459 100644 --- a/features/admin.extensions.v1/configs/server-configuration.tsx +++ b/features/admin.extensions.v1/configs/server-configuration.tsx @@ -66,13 +66,20 @@ export const serverConfigurationConfig: ServerConfigurationConfig = { ServerConfigurationsConstants.ANALYTICS_ENGINE_CONNECTOR_ID ], connectorToggleName: { - "account-recovery": ServerConfigurationsConstants.PASSWORD_RECOVERY_NOTIFICATION_BASED_ENABLE, - "account-recovery-username": ServerConfigurationsConstants.USERNAME_RECOVERY_ENABLE, - "account.lock.handler": ServerConfigurationsConstants.ACCOUNT_LOCK_ENABLE, - "multiattribute.login.handler": ServerConfigurationsConstants.MULTI_ATTRIBUTE_LOGIN_ENABLE, - "organization-self-service": ServerConfigurationsConstants.ORGANIZATION_SELF_SERVICE_ENABLE, - "self-sign-up": ServerConfigurationsConstants.SELF_REGISTRATION_ENABLE, - "sso.login.recaptcha": ServerConfigurationsConstants.RE_CAPTCHA_ALWAYS_ENABLE + [ServerConfigurationsConstants.ACCOUNT_RECOVERY]: + ServerConfigurationsConstants.PASSWORD_RECOVERY_NOTIFICATION_BASED_ENABLE, + [ServerConfigurationsConstants.ACCOUNT_RECOVERY_BY_USERNAME]: + ServerConfigurationsConstants.USERNAME_RECOVERY_ENABLE, + [ServerConfigurationsConstants.ACCOUNT_LOCK_HANDLER]: + ServerConfigurationsConstants.ACCOUNT_LOCK_ENABLE, + [ServerConfigurationsConstants.MULTI_ATTRIBUTE_LOGIN_HANDLER]: + ServerConfigurationsConstants.MULTI_ATTRIBUTE_LOGIN_ENABLE, + [ServerConfigurationsConstants.ORGANIZATION_SELF_SERVICE]: + ServerConfigurationsConstants.ORGANIZATION_SELF_SERVICE_ENABLE, + [ServerConfigurationsConstants.SELF_SIGNUP]: + ServerConfigurationsConstants.SELF_REGISTRATION_ENABLE, + [ServerConfigurationsConstants.SSO_LOGIN_RECAPTCHA]: + ServerConfigurationsConstants.RE_CAPTCHA_AFTER_MAX_FAILED_ATTEMPTS_ENABLE }, connectorsToHide: [ ServerConfigurationsConstants.ALTERNATIVE_LOGIN_IDENTIFIER, diff --git a/features/admin.server-configurations.v1/constants/server-configurations-constants.ts b/features/admin.server-configurations.v1/constants/server-configurations-constants.ts index 36aeef4f822..3edcd400332 100644 --- a/features/admin.server-configurations.v1/constants/server-configurations-constants.ts +++ b/features/admin.server-configurations.v1/constants/server-configurations-constants.ts @@ -238,6 +238,17 @@ export class ServerConfigurationsConstants { public static readonly PASSWORD_RECOVERY_QUESTION_FORCED_ENABLE: string = "Recovery.Question.Password.Forced.Enable"; + /** + * Connector toggle constants. + */ + public static readonly ACCOUNT_RECOVERY: string = "account-recovery"; + public static readonly ACCOUNT_RECOVERY_BY_USERNAME: string = "account-recovery-username"; + public static readonly ACCOUNT_LOCK_HANDLER: string = "account.lock.handler"; + public static readonly MULTI_ATTRIBUTE_LOGIN_HANDLER: string = "multiattribute.login.handler"; + public static readonly ORGANIZATION_SELF_SERVICE: string = "organization-self-service"; + public static readonly SELF_SIGNUP: string = "self-sign-up"; + public static readonly SSO_LOGIN_RECAPTCHA: string = "sso.login.recaptcha"; + /** * Login policies - account locking API Keyword constants. */ diff --git a/features/admin.server-configurations.v1/pages/connector-edit-page.tsx b/features/admin.server-configurations.v1/pages/connector-edit-page.tsx index e5e9fd443fb..2cfc320e346 100644 --- a/features/admin.server-configurations.v1/pages/connector-edit-page.tsx +++ b/features/admin.server-configurations.v1/pages/connector-edit-page.tsx @@ -184,7 +184,8 @@ export const ConnectorEditPage: FunctionComponent = // TODO: remove this once the ID is fixed updateData.properties.push({ name: GovernanceConnectorUtils.decodeConnectorPropertyName( - serverConfigurationConfig.connectorToggleName["account-recovery-username"] + serverConfigurationConfig.connectorToggleName[ + ServerConfigurationsConstants.ACCOUNT_RECOVERY_BY_USERNAME ] ), value: data.checked.toString() }); @@ -250,6 +251,13 @@ export const ConnectorEditPage: FunctionComponent = name: ServerConfigurationsConstants.PASSWORD_RECOVERY_NOTIFICATION_BASED_RE_CAPTCHA, value: data.checked.toString() }); + if (ServerConfigurationsConstants.ACCOUNT_RECOVERY_BY_USERNAME in + serverConfigurationConfig.connectorToggleName) { + updateRecoveryCaptchaData.properties.push({ + name: ServerConfigurationsConstants.USERNAME_RECOVERY_RE_CAPTCHA, + value: data.checked.toString() + }); + } updateGovernanceConnector(updateSSOCaptchaData, categoryId, connectorId) .then(() => { @@ -614,6 +622,16 @@ export const ConnectorEditPage: FunctionComponent = "botDetection.info.subSection2" ) } + { + serverConfigurationConfig.connectorToggleName[ + ServerConfigurationsConstants.ACCOUNT_RECOVERY_BY_USERNAME ] ? + (
  • + { t( + "extensions:manage.serverConfigurations.accountSecurity." + + "botDetection.info.subSection4" + ) } +
  • ) : <> + }
  • { t( "extensions:manage.serverConfigurations.accountSecurity." +