-
Notifications
You must be signed in to change notification settings - Fork 356
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
feat: password validation regexp in settings #19574
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Morten Svanaes <msvanaes@dhis2.org>
Signed-off-by: Morten Svanaes <msvanaes@dhis2.org>
Signed-off-by: Morten Svanaes <msvanaes@dhis2.org>
Signed-off-by: Morten Svanaes <msvanaes@dhis2.org>
larshelge
approved these changes
Jan 10, 2025
Signed-off-by: Morten Svanaes <msvanaes@dhis2.org>
...vices/dhis-service-core/src/main/java/org/hisp/dhis/user/LowerCasePatternValidationRule.java
Dismissed
Show dismissed
Hide dismissed
Signed-off-by: Morten Svanaes <msvanaes@dhis2.org>
Quality Gate passedIssues Measures |
david-mackessy
approved these changes
Jan 15, 2025
jbee
approved these changes
Jan 15, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This introduces a new system setting called
passwordValidationPattern
, this is a Regexp version of the internal password rule set, to be used in clients, most important the standard web UI.Since the password validation is configurable in the back-end, (currently only max and min password length), the rule aka. Regexp needs to be provided dynamically from the back-end.
This new property along with the min and max length properties are also exposed in the
LoginConfigController
, for easy access in non logged in environments, like the signup page.Fix
This PR also fixes an issue with the current back-end password rules not checking for a lower-case character present, this is enforced in the UI, but not in the back-end. To align this, a new password rule was added, called
LowerCasePatternValidationRule.java
. Since this rule was expected and always enforced in the UI, I see this as safe to add.Automatic tests
SystemSettingsTest.java
UserTest.java
LoginConfigControllerTest.java
UserAccountControllerTest.java
Manual test
passwordValidationPattern
property present and that the value is:^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[\W_])[A-Za-z\d\W_]{8,72}$
minPasswordLength
andmaxPasswordLength
JIRA: DHIS2-18574