mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 16:12:49 -05:00
[BEEEP] Add explicit error message when uploading the wrong license type (#1831)
This commit is contained in:
@ -661,6 +661,12 @@ namespace Bit.Core.Services
|
||||
OrganizationLicense license, User owner, string ownerKey, string collectionName, string publicKey,
|
||||
string privateKey)
|
||||
{
|
||||
if (license?.LicenseType != null && license.LicenseType != LicenseType.Organization)
|
||||
{
|
||||
throw new BadRequestException("Premium licenses cannot be applied to an organization. "
|
||||
+ "Upload this license from your personal account settings page.");
|
||||
}
|
||||
|
||||
if (license == null || !_licensingService.VerifyLicense(license))
|
||||
{
|
||||
throw new BadRequestException("Invalid license.");
|
||||
@ -806,6 +812,12 @@ namespace Bit.Core.Services
|
||||
throw new InvalidOperationException("Licenses require self hosting.");
|
||||
}
|
||||
|
||||
if (license?.LicenseType != null && license.LicenseType != LicenseType.Organization)
|
||||
{
|
||||
throw new BadRequestException("Premium licenses cannot be applied to an organization. "
|
||||
+ "Upload this license from your personal account settings page.");
|
||||
}
|
||||
|
||||
if (license == null || !_licensingService.VerifyLicense(license))
|
||||
{
|
||||
throw new BadRequestException("Invalid license.");
|
||||
|
@ -1030,6 +1030,12 @@ namespace Bit.Core.Services
|
||||
throw new InvalidOperationException("Licenses require self hosting.");
|
||||
}
|
||||
|
||||
if (license?.LicenseType != null && license.LicenseType != LicenseType.User)
|
||||
{
|
||||
throw new BadRequestException("Organization licenses cannot be applied to a user. "
|
||||
+ "Upload this license from the Organization settings page.");
|
||||
}
|
||||
|
||||
if (license == null || !_licenseService.VerifyLicense(license))
|
||||
{
|
||||
throw new BadRequestException("Invalid license.");
|
||||
|
Reference in New Issue
Block a user