mirror of
https://github.com/bitwarden/server.git
synced 2025-04-22 13:35:10 -05:00
license adjustments for premium creation
This commit is contained in:
parent
9c254a7325
commit
67edcd035c
@ -395,6 +395,12 @@ namespace Bit.Api.Controllers
|
|||||||
var valid = model.Validate(_globalSettings);
|
var valid = model.Validate(_globalSettings);
|
||||||
UserLicense license = null;
|
UserLicense license = null;
|
||||||
if(valid && _globalSettings.SelfHosted && model.License != null)
|
if(valid && _globalSettings.SelfHosted && model.License != null)
|
||||||
|
{
|
||||||
|
if(!HttpContext.Request.ContentLength.HasValue || HttpContext.Request.ContentLength.Value > 51200) // 50 KB
|
||||||
|
{
|
||||||
|
valid = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -402,16 +408,24 @@ namespace Bit.Api.Controllers
|
|||||||
using(var reader = new StreamReader(stream))
|
using(var reader = new StreamReader(stream))
|
||||||
{
|
{
|
||||||
var s = await reader.ReadToEndAsync();
|
var s = await reader.ReadToEndAsync();
|
||||||
|
if(string.IsNullOrWhiteSpace(s))
|
||||||
|
{
|
||||||
|
valid = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
license = JsonConvert.DeserializeObject<UserLicense>(s);
|
license = JsonConvert.DeserializeObject<UserLicense>(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
valid = false;
|
valid = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!valid)
|
if(!valid || (_globalSettings.SelfHosted && license == null))
|
||||||
{
|
{
|
||||||
throw new BadRequestException("Invalid license.");
|
throw new BadRequestException("Invalid license.");
|
||||||
}
|
}
|
||||||
|
@ -572,7 +572,7 @@ namespace Bit.Core.Services
|
|||||||
|
|
||||||
if(_globalSettings.SelfHosted)
|
if(_globalSettings.SelfHosted)
|
||||||
{
|
{
|
||||||
user.MaxStorageGb = 10240;
|
user.MaxStorageGb = 10240; // 10 TB
|
||||||
user.LicenseKey = license.LicenseKey;
|
user.LicenseKey = license.LicenseKey;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user