1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-12 16:48:12 -05:00

merged with main

This commit is contained in:
gbubemismith 2025-03-12 13:41:37 -04:00
commit 74c26f333a
No known key found for this signature in database
6 changed files with 32 additions and 24 deletions

View File

@ -11,6 +11,7 @@ using Bit.Core.AdminConsole.Services;
using Bit.Core.Billing.Entities;
using Bit.Core.Billing.Enums;
using Bit.Core.Billing.Extensions;
using Bit.Core.Billing.Pricing;
using Bit.Core.Billing.Repositories;
using Bit.Core.Billing.Services;
using Bit.Core.Billing.Services.Contracts;
@ -42,6 +43,7 @@ public class ProvidersController : Controller
private readonly IFeatureService _featureService;
private readonly IProviderPlanRepository _providerPlanRepository;
private readonly IProviderBillingService _providerBillingService;
private readonly IPricingClient _pricingClient;
private readonly string _stripeUrl;
private readonly string _braintreeMerchantUrl;
private readonly string _braintreeMerchantId;
@ -60,7 +62,8 @@ public class ProvidersController : Controller
IFeatureService featureService,
IProviderPlanRepository providerPlanRepository,
IProviderBillingService providerBillingService,
IWebHostEnvironment webHostEnvironment)
IWebHostEnvironment webHostEnvironment,
IPricingClient pricingClient)
{
_organizationRepository = organizationRepository;
_organizationService = organizationService;
@ -75,6 +78,7 @@ public class ProvidersController : Controller
_featureService = featureService;
_providerPlanRepository = providerPlanRepository;
_providerBillingService = providerBillingService;
_pricingClient = pricingClient;
_stripeUrl = webHostEnvironment.GetStripeUrl();
_braintreeMerchantUrl = webHostEnvironment.GetBraintreeMerchantUrl();
_braintreeMerchantId = globalSettings.Braintree.MerchantId;
@ -415,7 +419,9 @@ public class ProvidersController : Controller
return RedirectToAction("Index");
}
return View(new OrganizationEditModel(provider));
var plans = await _pricingClient.ListPlans();
return View(new OrganizationEditModel(provider, plans));
}
[HttpPost]

View File

@ -22,13 +22,14 @@ public class OrganizationEditModel : OrganizationViewModel
public OrganizationEditModel() { }
public OrganizationEditModel(Provider provider)
public OrganizationEditModel(Provider provider, List<Plan> plans)
{
Provider = provider;
BillingEmail = provider.Type == ProviderType.Reseller ? provider.BillingEmail : string.Empty;
PlanType = Core.Billing.Enums.PlanType.TeamsMonthly;
Plan = Core.Billing.Enums.PlanType.TeamsMonthly.GetDisplayAttribute()?.GetName();
LicenseKey = RandomLicenseKey;
_plans = plans;
}
public OrganizationEditModel(

View File

@ -114,6 +114,7 @@ public static class FeatureFlagKeys
public const string ItemShare = "item-share";
public const string RiskInsightsCriticalApplication = "pm-14466-risk-insights-critical-application";
public const string EnableRiskInsightsNotifications = "enable-risk-insights-notifications";
public const string DesktopSendUIRefresh = "desktop-send-ui-refresh";
public const string ReturnErrorOnExistingKeypair = "return-error-on-existing-keypair";
public const string UseTreeWalkerApiForPageDetailsCollection = "use-tree-walker-api-for-page-details-collection";

View File

@ -252,19 +252,19 @@ public class DeviceValidator(
{
case DeviceValidationResultType.InvalidUser:
result.ErrorDescription = "Invalid user";
customResponse.Add("ErrorModel", new ErrorResponseModel("invalid user"));
customResponse.Add("ErrorModel", new ErrorResponseModel("Invalid user."));
break;
case DeviceValidationResultType.InvalidNewDeviceOtp:
result.ErrorDescription = "Invalid New Device OTP";
customResponse.Add("ErrorModel", new ErrorResponseModel("invalid new device otp"));
customResponse.Add("ErrorModel", new ErrorResponseModel("Invalid new device OTP. Try again."));
break;
case DeviceValidationResultType.NewDeviceVerificationRequired:
result.ErrorDescription = "New device verification required";
customResponse.Add("ErrorModel", new ErrorResponseModel("new device verification required"));
customResponse.Add("ErrorModel", new ErrorResponseModel("New device verification required."));
break;
case DeviceValidationResultType.NoDeviceInformationProvided:
result.ErrorDescription = "No device information provided";
customResponse.Add("ErrorModel", new ErrorResponseModel("no device information provided"));
customResponse.Add("ErrorModel", new ErrorResponseModel("No device information provided."));
break;
}
return (result, customResponse);

View File

@ -172,7 +172,7 @@ public class DeviceValidatorTests
Assert.False(result);
Assert.NotNull(context.CustomResponse["ErrorModel"]);
var expectedErrorModel = new ErrorResponseModel("no device information provided");
var expectedErrorModel = new ErrorResponseModel("No device information provided.");
var actualResponse = (ErrorResponseModel)context.CustomResponse["ErrorModel"];
Assert.Equal(expectedErrorModel.Message, actualResponse.Message);
}
@ -418,7 +418,7 @@ public class DeviceValidatorTests
Assert.False(result);
Assert.NotNull(context.CustomResponse["ErrorModel"]);
// PM-13340: The error message should be "invalid user" instead of "no device information provided"
var expectedErrorMessage = "no device information provided";
var expectedErrorMessage = "No device information provided.";
var actualResponse = (ErrorResponseModel)context.CustomResponse["ErrorModel"];
Assert.Equal(expectedErrorMessage, actualResponse.Message);
}
@ -552,7 +552,7 @@ public class DeviceValidatorTests
Assert.False(result);
Assert.NotNull(context.CustomResponse["ErrorModel"]);
var expectedErrorMessage = "invalid new device otp";
var expectedErrorMessage = "Invalid new device OTP. Try again.";
var actualResponse = (ErrorResponseModel)context.CustomResponse["ErrorModel"];
Assert.Equal(expectedErrorMessage, actualResponse.Message);
}
@ -604,7 +604,7 @@ public class DeviceValidatorTests
Assert.False(result);
Assert.NotNull(context.CustomResponse["ErrorModel"]);
var expectedErrorMessage = "new device verification required";
var expectedErrorMessage = "New device verification required.";
var actualResponse = (ErrorResponseModel)context.CustomResponse["ErrorModel"];
Assert.Equal(expectedErrorMessage, actualResponse.Message);
}

View File

@ -15,7 +15,7 @@
services:
mssql:
image: bitwarden/mssql:{{{CoreVersion}}}
image: ghcr.io/bitwarden/mssql:{{{CoreVersion}}}
container_name: bitwarden-mssql
restart: always
stop_grace_period: 60s
@ -33,7 +33,7 @@ services:
- ../env/mssql.override.env
web:
image: bitwarden/web:{{{WebVersion}}}
image: ghcr.io/bitwarden/web:{{{WebVersion}}}
container_name: bitwarden-web
restart: always
volumes:
@ -43,7 +43,7 @@ services:
- ../env/uid.env
attachments:
image: bitwarden/attachments:{{{CoreVersion}}}
image: ghcr.io/bitwarden/attachments:{{{CoreVersion}}}
container_name: bitwarden-attachments
restart: always
volumes:
@ -53,7 +53,7 @@ services:
- ../env/uid.env
api:
image: bitwarden/api:{{{CoreVersion}}}
image: ghcr.io/bitwarden/api:{{{CoreVersion}}}
container_name: bitwarden-api
restart: always
volumes:
@ -69,7 +69,7 @@ services:
- public
identity:
image: bitwarden/identity:{{{CoreVersion}}}
image: ghcr.io/bitwarden/identity:{{{CoreVersion}}}
container_name: bitwarden-identity
restart: always
volumes:
@ -86,7 +86,7 @@ services:
- public
sso:
image: bitwarden/sso:{{{CoreVersion}}}
image: ghcr.io/bitwarden/sso:{{{CoreVersion}}}
container_name: bitwarden-sso
restart: always
volumes:
@ -103,7 +103,7 @@ services:
- public
admin:
image: bitwarden/admin:{{{CoreVersion}}}
image: ghcr.io/bitwarden/admin:{{{CoreVersion}}}
container_name: bitwarden-admin
restart: always
depends_on:
@ -121,7 +121,7 @@ services:
- public
icons:
image: bitwarden/icons:{{{CoreVersion}}}
image: ghcr.io/bitwarden/icons:{{{CoreVersion}}}
container_name: bitwarden-icons
restart: always
volumes:
@ -135,7 +135,7 @@ services:
- public
notifications:
image: bitwarden/notifications:{{{CoreVersion}}}
image: ghcr.io/bitwarden/notifications:{{{CoreVersion}}}
container_name: bitwarden-notifications
restart: always
volumes:
@ -150,7 +150,7 @@ services:
- public
events:
image: bitwarden/events:{{{CoreVersion}}}
image: ghcr.io/bitwarden/events:{{{CoreVersion}}}
container_name: bitwarden-events
restart: always
volumes:
@ -165,7 +165,7 @@ services:
- public
nginx:
image: bitwarden/nginx:{{{CoreVersion}}}
image: ghcr.io/bitwarden/nginx:{{{CoreVersion}}}
container_name: bitwarden-nginx
restart: always
depends_on:
@ -195,7 +195,7 @@ services:
{{#if EnableKeyConnector}}
key-connector:
image: bitwarden/key-connector:{{{KeyConnectorVersion}}}
image: ghcr.io/bitwarden/key-connector:{{{KeyConnectorVersion}}}
container_name: bitwarden-key-connector
restart: always
volumes:
@ -212,7 +212,7 @@ services:
{{#if EnableScim}}
scim:
image: bitwarden/scim:{{{CoreVersion}}}
image: ghcr.io/bitwarden/scim:{{{CoreVersion}}}
container_name: bitwarden-scim
restart: always
volumes: