Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the password length validation with Password max allowed length config. #7185

Merged
merged 15 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1844,6 +1844,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 @@ -1260,6 +1260,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 @@ -343,6 +343,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 @@ -482,6 +482,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 @@ -267,6 +267,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
144 changes: 35 additions & 109 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
Loading