mirror of
https://github.com/bitwarden/server.git
synced 2025-07-18 16:11:28 -05:00
[PS-1909] Make LicenseKey check null safe (#2444)
* Make LicenseKey check null safe * Catch Exception during Organization Validation * Use null-safe check in UpdateLicense * Formatting
This commit is contained in:
@ -700,7 +700,7 @@ public class OrganizationService : IOrganizationService
|
||||
}
|
||||
|
||||
var enabledOrgs = await _organizationRepository.GetManyByEnabledAsync();
|
||||
if (enabledOrgs.Any(o => o.LicenseKey.Equals(license.LicenseKey)))
|
||||
if (enabledOrgs.Any(o => string.Equals(o.LicenseKey, license.LicenseKey)))
|
||||
{
|
||||
throw new BadRequestException("License is already in use by another organization.");
|
||||
}
|
||||
@ -852,7 +852,7 @@ public class OrganizationService : IOrganizationService
|
||||
}
|
||||
|
||||
var enabledOrgs = await _organizationRepository.GetManyByEnabledAsync();
|
||||
if (enabledOrgs.Any(o => o.LicenseKey.Equals(license.LicenseKey) && o.Id != organizationId))
|
||||
if (enabledOrgs.Any(o => string.Equals(o.LicenseKey, license.LicenseKey) && o.Id != organizationId))
|
||||
{
|
||||
throw new BadRequestException("License is already in use by another organization.");
|
||||
}
|
||||
|
Reference in New Issue
Block a user