From c42928f26d79d56412d87673c7b828fbcb125d94 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 10 Nov 2017 09:21:44 -0500 Subject: [PATCH] prevent duplicate invite accepts --- src/Core/Services/Implementations/OrganizationService.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Core/Services/Implementations/OrganizationService.cs b/src/Core/Services/Implementations/OrganizationService.cs index 0980c6ea5..222e32539 100644 --- a/src/Core/Services/Implementations/OrganizationService.cs +++ b/src/Core/Services/Implementations/OrganizationService.cs @@ -940,6 +940,12 @@ namespace Bit.Core.Services } } + var existingOrgUser = await _organizationUserRepository.GetByOrganizationAsync(orgUser.OrganizationId, user.Email); + if(existingOrgUser != null) + { + throw new BadRequestException("You are already part of this organization."); + } + var tokenValidationFailed = true; try {