Skip to content

Commit

Permalink
Merge pull request #7185 from Malith-19/password-max-allowed-length-c…
Browse files Browse the repository at this point in the history
…onfig
  • Loading branch information
kayathiri4 authored Dec 20, 2024
2 parents f3d4e6f + 99ed0d0 commit ec7677a
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 113 deletions.
9 changes: 9 additions & 0 deletions .changeset/spicy-bottles-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@wso2is/admin.validation.v1": minor
"@wso2is/admin.core.v1": minor
"@wso2is/console": minor
"@wso2is/core": patch
"@wso2is/i18n": patch
---

Add the passwordMaxAllowed length config for password length values validation.
Original file line number Diff line number Diff line change
Expand Up @@ -1847,6 +1847,17 @@
{% else %}
"isPasswordInputValidationEnabled": true,
{% endif %}
"passwordPolicyConfigs": {
{% if identity_mgt.password_policy.items() is defined %}
{% for key, value in identity_mgt.password_policy.items() %}
{% if value is string %}
"{{ key }}": "{{ value }}"{{ "," if not loop.last }}
{% else %}
"{{ key }}": {{ value }}{{ "," if not loop.last }}
{% endif %}
{% endfor %}
{% endif %}
},
"isSignatureValidationCertificateAliasEnabled": {{ console.applications.ui.certificate_alias_enabled }},
"listAllAttributeDialects": {{ console.list_all_attribute_dialects }},
{% if console.enable_identity_claims is defined %}
Expand Down
3 changes: 3 additions & 0 deletions apps/console/src/public/deployment.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1261,6 +1261,9 @@
"roleMapping": false
},
"listAllAttributeDialects": true,
"passwordPolicyConfigs": {
"maxPasswordAllowedLength": 64
},
"privacyPolicyConfigs": {},
"productName": "WSO2 Identity Server",
"productVersionConfig": {
Expand Down
1 change: 1 addition & 0 deletions features/admin.core.v1/configs/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ export class Config {
isXacmlConnectorEnabled: window[ "AppUtils" ]?.getConfig()?.ui?.isXacmlConnectorEnabled,
legacyMode: window[ "AppUtils" ]?.getConfig()?.ui?.legacyMode,
listAllAttributeDialects: window[ "AppUtils" ]?.getConfig()?.ui?.listAllAttributeDialects,
passwordPolicyConfigs: window[ "AppUtils" ]?.getConfig()?.ui?.passwordPolicyConfigs,
privacyPolicyConfigs: window[ "AppUtils" ]?.getConfig()?.ui?.privacyPolicyConfigs,
productName: window[ "AppUtils" ]?.getConfig()?.ui?.productName,
productVersionConfig: window[ "AppUtils" ]?.getConfig()?.ui?.productVersionConfig,
Expand Down
14 changes: 14 additions & 0 deletions features/admin.core.v1/models/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,20 @@ export interface UIConfigInterface extends CommonUIConfigInterface<FeatureConfig
* Config to check whether the multiple emails and mobile numbers per user feature is enabled.
*/
isMultipleEmailsAndMobileNumbersEnabled?: boolean;
/**
* Password policy configs.
*/
passwordPolicyConfigs: PasswordPolicyConfigsInterface;
}

/**
* Password policy configs interface.
*/
interface PasswordPolicyConfigsInterface {
/**
* Maximum password length.
*/
maxPasswordAllowedLength: number;
}

/**
Expand Down
1 change: 1 addition & 0 deletions features/admin.core.v1/store/reducers/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ export const commonConfigReducerInitialState: CommonConfigReducerStateInterface<
isSignatureValidationCertificateAliasEnabled: undefined,
isTrustedAppConsentRequired: undefined,
listAllAttributeDialects: undefined,
passwordPolicyConfigs: null,
privacyPolicyConfigs: null,
productName: "",
productVersionConfig: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,12 @@ export class ValidationConfigConstants {
public static readonly VALIDATION_CONFIGURATION_FORM_FIELD_CONSTRAINTS: {
MIN_LENGTH: number,
MIN_VALUE: number;
PASSWORD_MAX_LENGTH: number;
PASSWORD_MAX_VALUE: number;
PASSWORD_MIN_LENGTH: number;
PASSWORD_MIN_VALUE: number;
} = {

MIN_LENGTH: 1,
MIN_VALUE: 0,
PASSWORD_MAX_LENGTH: 2,
PASSWORD_MAX_VALUE: 30,
PASSWORD_MIN_LENGTH: 1,
PASSWORD_MIN_VALUE: 5
};
Expand Down
142 changes: 34 additions & 108 deletions features/admin.validation.v1/pages/validation-config-edit.tsx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion modules/i18n/src/translations/en-US/portals/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const validation: validationNS = {
consecutiveChrMismatch: "Number of consecutive characters should be less than tha minimum " +
"length of the password.",
invalidConfig: "Unable to create password with the above configurations.",
maxLimitError: "The maximum length cannot be more than 30.",
maxLimitError: "The maximum length cannot be more than {{maxPasswordValue}}.",
minLimitError: "The minimum length cannot be less than 8.",
minMaxMismatch: "Minimum length should be less than maximum length.",
uniqueChrMismatch: "Number of unique characters should be less than tha minimum length of " +
Expand Down

0 comments on commit ec7677a

Please sign in to comment.