-
Notifications
You must be signed in to change notification settings - Fork 392
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
CB-4264 password policy configuration #2301
Conversation
minSpecialCharacters: 0, | ||
}; | ||
|
||
type ValidationResult = { isValid: true; errorMessage: null } | { isValid: false; errorMessage: string }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not to use:
interface IPasswordValidationSatus {
isValid: boolean;
message: string;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because there is no message if the status is valid
if(isValid) {message is null here}
}; | ||
} | ||
|
||
if (this.config.requiresUpperLowerCase && !(/[a-z]/.test(password) && /[A-Z]/.test(password))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets create a file for a regexps
. so it is reusable and in one place
const lowerCaseRegExp = /[a-z]/
const upperCaseRegExp = /[A-Z]/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can find a place for it after we will have a second use case
}; | ||
} | ||
|
||
if ((password.match(/[!@#$%^&*(),.?":{}|<>]/g) || []).length < this.config.minSpecialCharacters) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to regExp file
return { isValid: false, errorMessage: this.localizationService.translate('core_authentication_password_policy_upper_lower_case') }; | ||
} | ||
|
||
if ((password.match(/\d/g) || []).length < this.config.minDigits) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to regExp file
…cloudbeaver into CB-4264-password-policy
No description provided.