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:
parent
11922c6f49
commit
43bf0fbdb3
@ -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
|
||||
|
@ -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; }
|
||||
|
Loading…
Reference in New Issue
Block a user