1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-04 08:50:18 +01: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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 7 deletions

View File

@ -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

View File

@ -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; }