diff --git a/frontend/src/components/RegisterForm/RegisterFields.tsx b/frontend/src/components/RegisterForm/RegisterFields.tsx index f5427726a..15abd8390 100644 --- a/frontend/src/components/RegisterForm/RegisterFields.tsx +++ b/frontend/src/components/RegisterForm/RegisterFields.tsx @@ -36,7 +36,7 @@ export const UsernameField: React.FC<{ value={username} onChange={(e) => { // Lowercase as the user types, so what is shown is what gets sent - setUsername(e.target.value.toLocaleLowerCase()); + setUsername(e.target.value.toLowerCase()); }} onBlur={() => setUsername(normalizeUsername(username))} /> diff --git a/frontend/src/entrypoints/templates.ts b/frontend/src/entrypoints/templates.ts index 77587ee58..dec8ae6f0 100644 --- a/frontend/src/entrypoints/templates.ts +++ b/frontend/src/entrypoints/templates.ts @@ -1,4 +1,5 @@ -/* Copyright 2025 New Vector Ltd. +/* Copyright 2025, 2026 Element Creations Ltd. + * Copyright 2025 New Vector Ltd. * * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial * Please see LICENSE files in the repository root for full details. @@ -66,7 +67,7 @@ function patchUsernameInput(inputElement: HTMLInputElement) { inputElement.addEventListener("input", () => { // Simply lowercase things automatically, as this is not too disruptive - inputElement.value = inputElement.value.toLocaleLowerCase(); + inputElement.value = inputElement.value.toLowerCase(); const match = inputElement.value.match(VALID_USERNAME_RE); if (!inputElement.value.trim() || match !== null) { diff --git a/frontend/src/utils/registration.ts b/frontend/src/utils/registration.ts index 29fbe8359..bf1710b0d 100644 --- a/frontend/src/utils/registration.ts +++ b/frontend/src/utils/registration.ts @@ -37,7 +37,7 @@ export const VALID_LOCALPART_RE = /^[a-z0-9._=/+-]+$/; /** Normalize a username: trim and lowercase. */ export const normalizeUsername = (value: string): string => - value.trim().toLocaleLowerCase(); + value.trim().toLowerCase(); /** * Well-known policy violation codes, mapped to the key of their translated