From 7818764c370de642bfb58df759735d5de7f58339 Mon Sep 17 00:00:00 2001 From: SilverBirchh Date: Fri, 4 Sep 2026 10:16:30 +0100 Subject: [PATCH 1/2] bridgev2: add min/max length hints to login input fields 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. --- bridgev2/login.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bridgev2/login.go b/bridgev2/login.go index ff07e02f..ca514028 100644 --- a/bridgev2/login.go +++ b/bridgev2/login.go @@ -314,6 +314,9 @@ type LoginInputDataField struct { DefaultValue string `json:"default_value,omitempty"` // A regex pattern that the client can use to validate input client-side. Pattern string `json:"pattern,omitempty"` + // Minimum and maximum input length as a hint for the client + MinLength int `json:"min_length,omitempty"` + MaxLength int `json:"max_length,omitempty"` // For fields of type select, the valid options. // Pattern may also be filled with a regex that matches the same options. Options []string `json:"options,omitempty"` From 5d087d52f1de6f99ab73acf0cdb9127101a39f3a Mon Sep 17 00:00:00 2001 From: SilverBirchh Date: Fri, 4 Sep 2026 10:51:54 +0100 Subject: [PATCH 2/2] bridgev2: use omitzero for length hints and document them in the provisioning API --- bridgev2/login.go | 4 ++-- bridgev2/matrix/provisioning.yaml | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/bridgev2/login.go b/bridgev2/login.go index ca514028..d3e86971 100644 --- a/bridgev2/login.go +++ b/bridgev2/login.go @@ -315,8 +315,8 @@ type LoginInputDataField struct { // A regex pattern that the client can use to validate input client-side. Pattern string `json:"pattern,omitempty"` // Minimum and maximum input length as a hint for the client - MinLength int `json:"min_length,omitempty"` - MaxLength int `json:"max_length,omitempty"` + MinLength int `json:"min_length,omitzero"` + MaxLength int `json:"max_length,omitzero"` // For fields of type select, the valid options. // Pattern may also be filled with a regex that matches the same options. Options []string `json:"options,omitempty"` diff --git a/bridgev2/matrix/provisioning.yaml b/bridgev2/matrix/provisioning.yaml index c93e130d..177d69ed 100644 --- a/bridgev2/matrix/provisioning.yaml +++ b/bridgev2/matrix/provisioning.yaml @@ -883,6 +883,12 @@ components: type: string format: regex description: A regular expression that the field value must match. + min_length: + type: integer + description: Minimum input length as a hint for the client. + max_length: + type: integer + description: Maximum input length as a hint for the client. options: type: array description: For fields of type select, the valid options.