Skip to content

Use pattern to validate password length (fixes #3724)#3744

Merged
dessalines merged 1 commit intomainfrom
password-length
Jan 12, 2026
Merged

Use pattern to validate password length (fixes #3724)#3744
dessalines merged 1 commit intomainfrom
password-length

Conversation

@Nutomic
Copy link
Copy Markdown
Member

@Nutomic Nutomic commented Jan 9, 2026

The maxLength attribute seems to work as intended, the Mozilla docs mention "the browser will generally prevent user from entering more text than the maxlength attribute allows". And Chrome has the same behaviour, so its unlikely that we will get them to change it.

Instead we can use pattern for validation which works as expected in Chromium.

@dessalines
Copy link
Copy Markdown
Member

This means that whatever browser the user is using, is not mozilla or chrome based then, since its ignoring maxlength.

We have a lot of other maxLengths in the codebase, and I don't think we should handle it with pattern matching.

@matc-pub
Copy link
Copy Markdown
Collaborator

We could also keep maxLength and the pattern.

@Nutomic
Copy link
Copy Markdown
Member Author

Nutomic commented Jan 12, 2026

This means that whatever browser the user is using, is not mozilla or chrome based then, since its ignoring maxlength.

Not sure what you mean by this. I tested with Chromium, and it doesnt let you enter more than maxLength characters, so longer passwords are effectively truncated as described in #3724.

We have a lot of other maxLengths in the codebase, and I don't think we should handle it with pattern matching.

Other uses of maxLength look fine as they simply limit the length of various text fields. Only password needs to show a warning if it is too long.

We could also keep maxLength and the pattern.

That wouldnt fix the issue, then password would be truncated again.

Copy link
Copy Markdown
Member

@dessalines dessalines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright I think I understand, we don't want truncation, we want an error.

@dessalines dessalines merged commit 8446ed8 into main Jan 12, 2026
2 checks passed
@dessalines dessalines deleted the password-length branch January 12, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants