1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-23 20:41:04 -05:00

Refactor the code base on the pr comment

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
This commit is contained in:
Cy Okeke 2025-05-01 07:27:37 +01:00
parent 277f83f949
commit 45416c0534
No known key found for this signature in database
GPG Key ID: 88B341B55C84B45C

View File

@ -257,8 +257,18 @@ public class OrganizationsController : Controller
if (organization.PlanType != PlanType.Free && model.PlanType == PlanType.Free && model.Seats > 2)
{
model.Seats = 2;
model.MaxCollections = 2;
TempData["Error"] = "Organizations with more than 2 seats cannot be downgraded to the Free plan";
return RedirectToAction("Edit", new { id });
}
if (organization.PlanType != PlanType.Free && model.PlanType == PlanType.Free && model.MaxCollections > 2)
{
TempData["Error"] = $"Organizations with more than 2 collections cannot be downgraded to the Free plan. Your organization currently has {organization.MaxCollections} collections.";
return RedirectToAction("Edit", new { id });
}
if (organization.PlanType != PlanType.Free && model.PlanType == PlanType.Free)
{
model.MaxStorageGb = null;
model.ExpirationDate = null;
model.Enabled = true;