From 0cecbb2c2ef80762412196bc5074cade80bf10b3 Mon Sep 17 00:00:00 2001 From: Yun Date: Tue, 17 Dec 2024 14:36:45 -1000 Subject: [PATCH] Temporarily allow logins for usernames with periods (#1178) --- .../connect/create/useUsernameValidation.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/keychain/src/components/connect/create/useUsernameValidation.ts b/packages/keychain/src/components/connect/create/useUsernameValidation.ts index 8b906806b..327559bca 100644 --- a/packages/keychain/src/components/connect/create/useUsernameValidation.ts +++ b/packages/keychain/src/components/connect/create/useUsernameValidation.ts @@ -37,7 +37,8 @@ export function useUsernameValidation(username: string) { return; } - if (!/^[a-zA-Z0-9-]+$/.test(username)) { + // TEMP: allow periods for login and disabllow for signup below + if (!/^[a-zA-Z0-9-.]+$/.test(username)) { setValidation({ status: "invalid", error: new Error( @@ -74,6 +75,17 @@ export function useUsernameValidation(username: string) { if (controller.signal.aborted) return; if (e.message === "ent: account not found") { + // TEMP: disallow periods for signup + if (username.includes(".")) { + setValidation({ + status: "invalid", + error: new Error( + "Username can only contain letters, numbers, and hyphens", + ), + }); + return; + } + setValidation({ status: "valid", exists: false,