1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-14 01:28:14 -05:00

license when no billing info

This commit is contained in:
Kyle Spearrin 2017-09-18 17:57:37 -04:00
parent 0caacaa5aa
commit 9b790b7edc
2 changed files with 4 additions and 2 deletions

View File

@ -426,7 +426,8 @@ namespace Bit.Api.Controllers
}
else
{
return new BillingResponseModel(user);
var license = await _userService.GenerateLicenseAsync(user);
return new BillingResponseModel(user, license);
}
}

View File

@ -23,12 +23,13 @@ namespace Bit.Core.Models.Api
Expiration = License.Expires;
}
public BillingResponseModel(User user)
public BillingResponseModel(User user, UserLicense license)
: base("billing")
{
StorageName = user.Storage.HasValue ? Utilities.CoreHelpers.ReadableBytesSize(user.Storage.Value) : null;
StorageGb = user.Storage.HasValue ? Math.Round(user.Storage.Value / 1073741824D, 2) : 0; // 1 GB
MaxStorageGb = user.MaxStorageGb;
License = license;
Expiration = user.PremiumExpirationDate;
}