diff --git a/src/Api/Public/Controllers/MembersController.cs b/src/Api/Public/Controllers/MembersController.cs index 93ed8e1a7d..882d8fc06e 100644 --- a/src/Api/Public/Controllers/MembersController.cs +++ b/src/Api/Public/Controllers/MembersController.cs @@ -203,5 +203,27 @@ namespace Bit.Api.Public.Controllers await _organizationService.DeleteUserAsync(_currentContext.OrganizationId.Value, id, null); return new OkResult(); } + + /// + /// Re-invite a member. + /// + /// + /// Re-sends the invitation email to an organization member. + /// + /// The identifier of the member to re-invite. + [HttpPost("{id}/reinvite")] + [ProducesResponseType((int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ErrorResponseModel), (int)HttpStatusCode.BadRequest)] + [ProducesResponseType((int)HttpStatusCode.NotFound)] + public async Task PostReinvite(Guid id) + { + var existingUser = await _organizationUserRepository.GetByIdAsync(id); + if(existingUser == null || existingUser.OrganizationId != _currentContext.OrganizationId) + { + return new NotFoundResult(); + } + await _organizationService.ResendInviteAsync(_currentContext.OrganizationId.Value, null, id); + return new OkResult(); + } } } diff --git a/src/Core/Services/IOrganizationService.cs b/src/Core/Services/IOrganizationService.cs index 24c73b6c33..c59472d037 100644 --- a/src/Core/Services/IOrganizationService.cs +++ b/src/Core/Services/IOrganizationService.cs @@ -33,7 +33,7 @@ namespace Bit.Core.Services OrganizationUserType type, bool accessAll, string externalId, IEnumerable collections); Task> InviteUserAsync(Guid organizationId, Guid? invitingUserId, IEnumerable emails, OrganizationUserType type, bool accessAll, string externalId, IEnumerable collections); - Task ResendInviteAsync(Guid organizationId, Guid invitingUserId, Guid organizationUserId); + Task ResendInviteAsync(Guid organizationId, Guid? invitingUserId, Guid organizationUserId); Task AcceptUserAsync(Guid organizationUserId, User user, string token); Task ConfirmUserAsync(Guid organizationId, Guid organizationUserId, string key, Guid confirmingUserId); Task SaveUserAsync(OrganizationUser user, Guid? savingUserId, IEnumerable collections); diff --git a/src/Core/Services/Implementations/OrganizationService.cs b/src/Core/Services/Implementations/OrganizationService.cs index f698473206..683b073f6f 100644 --- a/src/Core/Services/Implementations/OrganizationService.cs +++ b/src/Core/Services/Implementations/OrganizationService.cs @@ -914,7 +914,7 @@ namespace Bit.Core.Services return orgUsers; } - public async Task ResendInviteAsync(Guid organizationId, Guid invitingUserId, Guid organizationUserId) + public async Task ResendInviteAsync(Guid organizationId, Guid? invitingUserId, Guid organizationUserId) { var orgUser = await _organizationUserRepository.GetByIdAsync(organizationUserId); if(orgUser == null || orgUser.OrganizationId != organizationId ||