1
0
mirror of https://github.com/bitwarden/server.git synced 2024-12-23 17:07:42 +01:00

add check for org id mismatch

This commit is contained in:
Kyle Spearrin 2017-05-07 00:08:23 -04:00
parent d9c67ffeff
commit d7040b9ab6

View File

@ -117,6 +117,13 @@ namespace Bit.Api.Controllers
throw new NotFoundException();
}
var modelOrgId = string.IsNullOrWhiteSpace(model.OrganizationId) ? (Guid?)null : new Guid(model.OrganizationId);
if(login.OrganizationId != modelOrgId)
{
throw new BadRequestException("Organization mismatch. Re-sync if you recently shared this login, " +
"then try again.");
}
await _cipherService.SaveDetailsAsync(model.ToCipherDetails(login), userId);
var response = new LoginResponseModel(login);