Skip to content

Commit

Permalink
Temporarily allow logins for usernames with periods
Browse files Browse the repository at this point in the history
  • Loading branch information
broody committed Dec 18, 2024
1 parent ae4c5e5 commit 8409d48
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 8409d48

Please sign in to comment.