diff --git a/apps/web/src/components/Dashboard/Team.tsx b/apps/web/src/components/Dashboard/Team.tsx index bb871b243..98aedb9ed 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,14 +171,15 @@ export const TeamContent = ({ 'Content-Type': 'application/json', }, method: 'POST', - body: JSON.stringify({ user_id: userToAdd.trim() }), + body: JSON.stringify({ user_email: userToAdd.trim() }), } ) 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 @@ -234,20 +235,11 @@ export const TeamContent = ({
Copy your user ID
-