1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-21 18:53:29 +00:00

Merge branch 'master' into feature/maui-migration

Fixed conflicts

# Conflicts:
#	src/App/Resources/AppResources.cs.Designer.cs
#	src/App/Resources/AppResources.da.Designer.cs
#	src/App/Resources/AppResources.de.Designer.cs
#	src/App/Resources/AppResources.es.Designer.cs
#	src/App/Resources/AppResources.fi.Designer.cs
#	src/App/Resources/AppResources.fr.Designer.cs
#	src/App/Resources/AppResources.hi.Designer.cs
#	src/App/Resources/AppResources.hr.Designer.cs
#	src/App/Resources/AppResources.hu.Designer.cs
#	src/App/Resources/AppResources.id.Designer.cs
#	src/App/Resources/AppResources.it.Designer.cs
#	src/App/Resources/AppResources.ja.Designer.cs
#	src/App/Resources/AppResources.nl.Designer.cs
#	src/App/Resources/AppResources.pl.Designer.cs
#	src/App/Resources/AppResources.pt-BR.Designer.cs
#	src/App/Resources/AppResources.pt-PT.Designer.cs
#	src/App/Resources/AppResources.ro.Designer.cs
#	src/App/Resources/AppResources.ru.Designer.cs
#	src/App/Resources/AppResources.sk.Designer.cs
#	src/App/Resources/AppResources.sv.Designer.cs
#	src/App/Resources/AppResources.th.Designer.cs
#	src/App/Resources/AppResources.tr.Designer.cs
#	src/App/Resources/AppResources.uk.Designer.cs
#	src/App/Resources/AppResources.vi.Designer.cs
#	src/App/Resources/AppResources.zh-Hans.Designer.cs
#	src/App/Resources/AppResources.zh-Hant.Designer.cs
#	src/Core/Controls/Settings/BaseSettingControlView.cs
#	src/Core/Pages/Accounts/EnvironmentPageViewModel.cs
#	src/Core/Pages/Accounts/HomePage.xaml.cs
#	src/Core/Pages/Accounts/HomePageViewModel.cs
#	src/Core/Pages/Accounts/SetPasswordPageViewModel.cs
#	src/Core/Pages/Settings/SecuritySettingsPageViewModel.cs
#	src/Core/Pages/TabsPage.cs
#	src/Core/Services/StateMigrationService.cs
#	src/Core/Utilities/BoolToColorConverter.cs
This commit is contained in:
Dinis Vieira
2023-11-19 15:06:02 +00:00
113 changed files with 1474 additions and 593 deletions

View File

@@ -1,9 +1,34 @@
namespace Bit.Core.Models.Data
using System.Text.RegularExpressions;
using Bit.Core.Utilities;
using BwRegion = Bit.Core.Enums.Region;
namespace Bit.Core.Models.Data
{
public class EnvironmentUrlData
{
public static EnvironmentUrlData DefaultUS = new EnvironmentUrlData { Base = "https://vault.bitwarden.com" };
public static EnvironmentUrlData DefaultEU = new EnvironmentUrlData { Base = "https://vault.bitwarden.eu" };
public static EnvironmentUrlData DefaultUS = new EnvironmentUrlData
{
Base = "https://vault.bitwarden.com",
Api = "https://api.bitwarden.com",
Identity = "https://identity.bitwarden.com",
Icons = "https://icons.bitwarden.net",
WebVault = "https://vault.bitwarden.com",
Notifications = "https://notifications.bitwarden.com",
Events = "https://events.bitwarden.com",
Domain = "bitwarden.com"
};
public static EnvironmentUrlData DefaultEU = new EnvironmentUrlData
{
Base = "https://vault.bitwarden.eu",
Api = "https://api.bitwarden.eu",
Identity = "https://identity.bitwarden.eu",
Icons = "https://icons.bitwarden.eu",
WebVault = "https://vault.bitwarden.eu",
Notifications = "https://notifications.bitwarden.eu",
Events = "https://events.bitwarden.eu",
Domain = "bitwarden.eu"
};
public string Base { get; set; }
public string Api { get; set; }
@@ -12,6 +37,7 @@
public string Notifications { get; set; }
public string WebVault { get; set; }
public string Events { get; set; }
public string Domain { get; set; }
public bool IsEmpty => string.IsNullOrEmpty(Base)
&& string.IsNullOrEmpty(Api)
@@ -20,5 +46,63 @@
&& string.IsNullOrEmpty(Notifications)
&& string.IsNullOrEmpty(WebVault)
&& string.IsNullOrEmpty(Events);
public BwRegion Region
{
get
{
if (Base == BwRegion.US.BaseUrl())
{
return BwRegion.US;
}
if (Base == BwRegion.EU.BaseUrl())
{
return BwRegion.EU;
}
return BwRegion.SelfHosted;
}
}
public EnvironmentUrlData FormatUrls()
{
return new EnvironmentUrlData
{
Base = FormatUrl(Base),
Api = FormatUrl(Api),
Identity = FormatUrl(Identity),
Icons = FormatUrl(Icons),
Notifications = FormatUrl(Notifications),
WebVault = FormatUrl(WebVault),
Events = FormatUrl(Events)
};
}
private string FormatUrl(string url)
{
if (string.IsNullOrWhiteSpace(url))
{
return null;
}
url = Regex.Replace(url, "\\/+$", string.Empty);
if (!url.StartsWith("http://") && !url.StartsWith("https://"))
{
url = string.Concat("https://", url);
}
return url.Trim();
}
public string GetDomainOrHostname()
{
var url = WebVault ?? Base ?? Api ?? Identity;
if (string.IsNullOrWhiteSpace(url))
{
return string.Empty;
}
if (url.Contains(BwRegion.US.Domain()) || url.Contains(BwRegion.EU.Domain()))
{
return CoreHelpers.GetDomain(url);
}
return CoreHelpers.GetHostname(url);
}
}
}

View File

@@ -15,5 +15,6 @@
public bool ManagePolicies { get; set; }
public bool ManageSso { get; set; }
public bool ManageUsers { get; set; }
public bool ManageResetPassword { get; set; }
}
}

View File

@@ -1,6 +1,6 @@
using System;
using Bit.Core.Enums;
using Bit.Core.Enums;
using Bit.Core.Models.Data;
using BwRegion = Bit.Core.Enums.Region;
namespace Bit.Core.Models.Domain
{
@@ -102,12 +102,14 @@ namespace Bit.Core.Models.Domain
return;
}
Region = copy.Region;
EnvironmentUrls = copy.EnvironmentUrls;
VaultTimeout = copy.VaultTimeout;
VaultTimeoutAction = copy.VaultTimeoutAction;
ScreenCaptureAllowed = copy.ScreenCaptureAllowed;
}
public BwRegion? Region;
public EnvironmentUrlData EnvironmentUrls;
[Obsolete("Feb 10 2023: VaultTimeout has been deprecated in favor of stored prefs to retain value after logout. It remains here to allow for migration during app upgrade.")]
public int? VaultTimeout;

View File

@@ -1,10 +0,0 @@
namespace Bit.Core.Models.Domain
{
public class EnvironmentUrls
{
public string Base { get; set; }
public string Api { get; set; }
public string Identity { get; set; }
public string Events { get; set; }
}
}

View File

@@ -11,6 +11,12 @@
/// Occurs when a user logs in with a master password that does not meet an organization's master password
/// policy that is enforced on login.
/// </summary>
WeakMasterPasswordOnLogin
WeakMasterPasswordOnLogin,
/// <summary>
/// Occurs when a TDE user without a password obtains the password reset permission.
/// Set post login & decryption client side and by server in sync (to catch logged in users).
/// </summary>
TdeUserWithoutPasswordHasPasswordResetPermission,
}
}

View File

@@ -46,7 +46,11 @@ namespace Bit.Core.Models.Domain
case ForwardedEmailServiceType.DuckDuckGo:
return new ForwarderOptions { ApiKey = DuckDuckGoApiKey };
case ForwardedEmailServiceType.Fastmail:
return new ForwarderOptions { ApiKey = FastMailApiKey };
return new FastmailForwarderOptions
{
ApiKey = FastMailApiKey,
Website = EmailWebsite
};
case ForwardedEmailServiceType.FirefoxRelay:
return new ForwarderOptions { ApiKey = FirefoxRelayApiAccessToken };
case ForwardedEmailServiceType.SimpleLogin:

View File

@@ -7,7 +7,7 @@ namespace Bit.Core.Models.Request
public string MasterPasswordHash { get; set; }
public string Key { get; set; }
public string MasterPasswordHint { get; set; }
public KeysRequest Keys { get; set; }
public KeysRequest? Keys { get; set; }
public KdfType Kdf { get; set; }
public int KdfIterations { get; set; }
public int? KdfMemory { get; set; }

View File

@@ -20,5 +20,6 @@ namespace Bit.Core.Models.Response
public List<ProfileOrganizationResponse> Organizations { get; set; }
public bool UsesKeyConnector { get; set; }
public string AvatarColor { get; set; }
public bool HasManageResetPasswordPermission { get; set; }
}
}

View File

@@ -22,21 +22,7 @@ namespace Bit.Core.Models.View
Email = a.Profile?.Email;
Name = a.Profile?.Name;
AvatarColor = a.Profile?.AvatarColor;
Hostname = ParseEndpoint(a.Settings?.EnvironmentUrls);
}
private string ParseEndpoint(EnvironmentUrlData urls)
{
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;
Hostname = a.Settings?.EnvironmentUrls?.GetDomainOrHostname();
}
public bool IsAccount { get; set; }