From 46edac597bed9e9b8efa32453e4aeae95f9e4783 Mon Sep 17 00:00:00 2001 From: Mish Ushakov Date: Tue, 12 Nov 2024 16:41:20 +0100 Subject: [PATCH 1/2] add user by e-mail --- apps/web/src/components/Dashboard/Team.tsx | 46 ++++------------------ 1 file changed, 7 insertions(+), 39 deletions(-) diff --git a/apps/web/src/components/Dashboard/Team.tsx b/apps/web/src/components/Dashboard/Team.tsx index bb871b243..d6383963a 100644 --- a/apps/web/src/components/Dashboard/Team.tsx +++ b/apps/web/src/components/Dashboard/Team.tsx @@ -31,8 +31,8 @@ interface TeamMember { email: string } -const uuidRegex = new RegExp( - '^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$' +const emailRegex = new RegExp( + '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$' ) export const TeamContent = ({ @@ -155,10 +155,10 @@ export const TeamContent = ({ } const addUserToTeam = async () => { - if (!uuidRegex.test(userToAdd)) { + if (!emailRegex.test(userToAdd)) { toast({ - title: 'Invalid user ID', - description: 'The user ID must be a valid UUID', + title: 'Invalid email', + description: 'The email must be a valid email address', }) return } @@ -171,7 +171,7 @@ export const TeamContent = ({ 'Content-Type': 'application/json', }, method: 'POST', - body: JSON.stringify({ user_id: userToAdd.trim() }), + body: JSON.stringify({ user_email: userToAdd.trim() }), } ) @@ -234,20 +234,11 @@ export const TeamContent = ({

Add members to your team

-
-

How to invite people to your team

-
    -
  1. Have them create an E2B account
  2. -
  3. Ask them to send you their user ID (Click on "Copy your user ID" button)
  4. -
  5. Paste their user ID and click on "Add user"
  6. -
-
-
{ e.preventDefault() @@ -259,29 +250,6 @@ export const TeamContent = ({
-

Your user ID

-
- -
- - { - navigator.clipboard.writeText(user.id) - toast({ - title: 'User ID copied to clipboard', - }) - }} - > -

Copy your user ID

- -
-

Team members

{isLoading ? (
From ffee743f9e0c95e57341f5ed7af9b42a79521660 Mon Sep 17 00:00:00 2001 From: Mish Ushakov Date: Fri, 15 Nov 2024 20:03:12 +0100 Subject: [PATCH 2/2] updated user invite message --- apps/web/src/components/Dashboard/Team.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/Dashboard/Team.tsx b/apps/web/src/components/Dashboard/Team.tsx index d6383963a..98aedb9ed 100644 --- a/apps/web/src/components/Dashboard/Team.tsx +++ b/apps/web/src/components/Dashboard/Team.tsx @@ -178,7 +178,8 @@ export const TeamContent = ({ if (!res.ok) { toast({ title: 'An error occurred', - description: 'We were unable to add the user to the team', + description: + 'We were unable to add the user to the team. Make sure the user is registered with the email address provided.', }) console.log(res.statusText) return