diff --git a/src/App/Controls/AccountViewCell/AccountViewCellViewModel.cs b/src/App/Controls/AccountViewCell/AccountViewCellViewModel.cs index 45e2f2455..2cc33d54a 100644 --- a/src/App/Controls/AccountViewCell/AccountViewCellViewModel.cs +++ b/src/App/Controls/AccountViewCell/AccountViewCellViewModel.cs @@ -36,7 +36,7 @@ namespace Bit.App.Controls public bool ShowHostname { - get => !string.IsNullOrWhiteSpace(AccountView.Hostname) && AccountView.Hostname != "vault.bitwarden.com"; + get => !string.IsNullOrWhiteSpace(AccountView.Hostname); } public bool IsActive diff --git a/src/Core/Models/View/AccountView.cs b/src/Core/Models/View/AccountView.cs index 7224d51bd..958f1435d 100644 --- a/src/Core/Models/View/AccountView.cs +++ b/src/Core/Models/View/AccountView.cs @@ -1,4 +1,5 @@ using Bit.Core.Enums; +using Bit.Core.Models.Data; using Bit.Core.Models.Domain; using Bit.Core.Utilities; @@ -21,14 +22,21 @@ namespace Bit.Core.Models.View Email = a.Profile?.Email; Name = a.Profile?.Name; AvatarColor = a.Profile?.AvatarColor; - if (!string.IsNullOrWhiteSpace(a.Settings?.EnvironmentUrls?.WebVault)) + Hostname = ParseEndpoint(a.Settings?.EnvironmentUrls); + } + + private string ParseEndpoint(EnvironmentUrlData urls) + { + var url = urls?.WebVault ?? urls?.Base; + if (!string.IsNullOrWhiteSpace(url)) { - Hostname = CoreHelpers.GetHostname(a.Settings?.EnvironmentUrls?.WebVault); - } - else if (!string.IsNullOrWhiteSpace(a.Settings?.EnvironmentUrls?.Base)) - { - Hostname = CoreHelpers.GetHostname(a.Settings?.EnvironmentUrls?.Base); + if (url.Contains("bitwarden.com") || url.Contains("bitwarden.eu")) + { + return CoreHelpers.GetDomain(url); + } + return CoreHelpers.GetHostname(url); } + return string.Empty; } public bool IsAccount { get; set; }