Skip to content

[DESK-23336] bridgev2: add min/max length hints to login input fields - #564

Merged
tulir merged 2 commits into
mautrix:mainfrom
SilverBirchh:login-field-length
Sep 4, 2026
Merged

[DESK-23336] bridgev2: add min/max length hints to login input fields#564
tulir merged 2 commits into
mautrix:mainfrom
SilverBirchh:login-field-length

Conversation

@SilverBirchh

Copy link
Copy Markdown
Contributor

Clients only receive a regex pattern for user input fields, to know how many characters to accept they would have to parse the regex. Bridges that ask for fixed-length codes can now say so directly, letting clients cap the input and render a proper code field.

Checklist

Clients only receive a regex pattern for user input fields, so to know how
many characters to accept they would have to parse the regex. Bridges that
ask for fixed-length codes can now say so directly, letting clients cap the
input and render a proper code field.
@SilverBirchh SilverBirchh changed the title bridgev2: add min/max length hints to login input fields [DESK-23336] bridgev2: add min/max length hints to login input fields Sep 4, 2026
@SilverBirchh
SilverBirchh requested a review from tulir September 4, 2026 09:27
Comment thread bridgev2/login.go Outdated
Comment on lines +318 to +319
MinLength int `json:"min_length,omitempty"`
MaxLength int `json:"max_length,omitempty"`

@tulir tulir Sep 4, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

omitempty only omits null and empty objects/arrays in jsonv2, so to prepare for that, ints and booleans need to use omitzero instead (which omits zero values defined by go, like 0, false, nil and probably empty non-pointer structs too)

They should also be added to the openapi doc (./matrix/provisioning.yaml)

Suggested change
MinLength int `json:"min_length,omitempty"`
MaxLength int `json:"max_length,omitempty"`
MinLength int `json:"min_length,omitzero"`
MaxLength int `json:"max_length,omitzero"`

@tulir
tulir merged commit 3ef5ae6 into mautrix:main Sep 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants