From 18d52cf5bf633aaf6b5063a1095069bbbd0ecda3 Mon Sep 17 00:00:00 2001 From: Alec LaLonde Date: Thu, 25 Feb 2021 15:27:56 -0700 Subject: [PATCH] Add username lowercase mutation --- .../migrations/1614278149225_lowercase_player_username/up.sql | 1 + packages/web/components/Setup/SetupUsername.tsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 hasura/migrations/1614278149225_lowercase_player_username/up.sql diff --git a/hasura/migrations/1614278149225_lowercase_player_username/up.sql b/hasura/migrations/1614278149225_lowercase_player_username/up.sql new file mode 100644 index 00000000..9899d658 --- /dev/null +++ b/hasura/migrations/1614278149225_lowercase_player_username/up.sql @@ -0,0 +1 @@ +UPDATE player SET username=lower(username); diff --git a/packages/web/components/Setup/SetupUsername.tsx b/packages/web/components/Setup/SetupUsername.tsx index b8a27dcb..bf96af88 100644 --- a/packages/web/components/Setup/SetupUsername.tsx +++ b/packages/web/components/Setup/SetupUsername.tsx @@ -5,7 +5,7 @@ import { useUpdatePlayerUsernameMutation } from 'graphql/autogen/types'; import { useUser } from 'lib/hooks'; import React, { useEffect, useState } from 'react'; -const USERNAME_REGEX = /^[a-zA-Z0-9](_(?!(\.|_))|\.(?!(_|\.))|[a-zA-Z0-9]){2,18}[a-zA-Z0-9]$/; +const USERNAME_REGEX = /^[a-z0-9](_(?!(\.|_))|\.(?!(_|\.))|[a-z0-9]){2,18}[a-z0-9]$/; export type SetupUsernameProps = { username: string;