1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-18 09:13:15 +00:00

[PM-3086] Account switcher endpoint use domain string for Bitwarden production environments (#2773)

This commit is contained in:
André Bispo
2023-09-19 10:35:37 +01:00
committed by GitHub
parent 11922c6f49
commit 43bf0fbdb3
2 changed files with 15 additions and 7 deletions

View File

@@ -36,7 +36,7 @@ namespace Bit.App.Controls
public bool ShowHostname public bool ShowHostname
{ {
get => !string.IsNullOrWhiteSpace(AccountView.Hostname) && AccountView.Hostname != "vault.bitwarden.com"; get => !string.IsNullOrWhiteSpace(AccountView.Hostname);
} }
public bool IsActive public bool IsActive

View File

@@ -1,4 +1,5 @@
using Bit.Core.Enums; using Bit.Core.Enums;
using Bit.Core.Models.Data;
using Bit.Core.Models.Domain; using Bit.Core.Models.Domain;
using Bit.Core.Utilities; using Bit.Core.Utilities;
@@ -21,14 +22,21 @@ namespace Bit.Core.Models.View
Email = a.Profile?.Email; Email = a.Profile?.Email;
Name = a.Profile?.Name; Name = a.Profile?.Name;
AvatarColor = a.Profile?.AvatarColor; AvatarColor = a.Profile?.AvatarColor;
if (!string.IsNullOrWhiteSpace(a.Settings?.EnvironmentUrls?.WebVault)) Hostname = ParseEndpoint(a.Settings?.EnvironmentUrls);
{
Hostname = CoreHelpers.GetHostname(a.Settings?.EnvironmentUrls?.WebVault);
} }
else if (!string.IsNullOrWhiteSpace(a.Settings?.EnvironmentUrls?.Base))
private string ParseEndpoint(EnvironmentUrlData urls)
{ {
Hostname = CoreHelpers.GetHostname(a.Settings?.EnvironmentUrls?.Base); var url = urls?.WebVault ?? urls?.Base;
if (!string.IsNullOrWhiteSpace(url))
{
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; } public bool IsAccount { get; set; }