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 clickin

Improve Password Length Validation for BCrypt Compatibility #47708

submited by
Style Pass
2023-03-21 22:00:06

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.

This Pull Request has been created because we identified a need to improve password length validation for BCrypt compatibility in the ActiveModel::SecurePassword module. The current validation only considers the character count, which may not accurately reflect the byte size limit imposed by BCrypt.

Updating the validation to consider both character count and byte size. This ensures that passwords adhere to the 72-byte limit imposed by BCrypt while providing a more user-friendly error message for character count.

Adding a custom validation error message key :too_long_in_bytes for the byte size validation. This allows for better internationalization (i18n) support and customization of the error message when the byte size limit is exceeded.

Leave a Comment