mirror of
https://github.com/bitwarden/mobile
synced 2025-12-15 07:43:37 +00:00
* PM-1575 Added new models for Fido2Key
* PM-1575 Added discoverable passkeys and WIP non-discoverable ones
* PM-1575 Fix format
* PM-1575 Added non-discoverable passkeys to login UI
* PM-1575 Added copy application icon to Fido2Key UI
* PM-1575 Updated bwi font with the updated passkey icon
* PM-1575 For now just display Available for two-step login on non-discoverable passkey inside of a cipher login
* PM-1575 Fix non-discoverable passkey visibility
* PM-1575 remove Passkeys as a filter in the vault list
* PM-1575 Display error toast if there is a duplicate passkey when moving a cipher to an org
* Revert "PM-1575 Display error toast if there is a duplicate passkey when moving a cipher to an org"
This reverts commit 78e6353602.
* [PM-2378] Display error toast on duplicate Passkey when moving cipher to an organization (#2594)
* PM-2378 Display error toast if there is a duplicate passkey when moving a cipher to an org
* PM-3097 Fix issue when moving cipher with passkey to an org where the uniqueness should be taken into consideration on different passkeys types and also the Username (#2632)
* PM-3096 Fix non-discoverable passkey to be taken into account when encrypting a cipher which was causing the passkey to be removed when moving to an org (#2637)
114 lines
3.0 KiB
C#
114 lines
3.0 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text.RegularExpressions;
|
|
using Bit.Core.Enums;
|
|
using Bit.Core.Models.Domain;
|
|
using Bit.Core.Utilities;
|
|
|
|
namespace Bit.Core.Models.View
|
|
{
|
|
public class LoginUriView : View, ILaunchableView
|
|
{
|
|
private HashSet<string> _canLaunchWhitelist = new HashSet<string>
|
|
{
|
|
"https://",
|
|
"http://",
|
|
"ssh://",
|
|
"ftp://",
|
|
"sftp://",
|
|
"irc://",
|
|
"vnc://",
|
|
"chrome://",
|
|
"iosapp://",
|
|
"androidapp://",
|
|
};
|
|
|
|
private string _uri;
|
|
private string _domain;
|
|
private string _host;
|
|
private bool? _canLaunch;
|
|
|
|
public LoginUriView() { }
|
|
|
|
public LoginUriView(LoginUri u)
|
|
{
|
|
Match = u.Match;
|
|
}
|
|
|
|
public UriMatchType? Match { get; set; }
|
|
public string Uri
|
|
{
|
|
get => _uri;
|
|
set
|
|
{
|
|
_uri = value;
|
|
_domain = null;
|
|
_canLaunch = null;
|
|
}
|
|
}
|
|
|
|
public string Domain
|
|
{
|
|
get
|
|
{
|
|
if (_domain == null && Uri != null)
|
|
{
|
|
_domain = CoreHelpers.GetDomain(Uri);
|
|
if (_domain == string.Empty)
|
|
{
|
|
_domain = null;
|
|
}
|
|
}
|
|
return _domain;
|
|
}
|
|
}
|
|
|
|
public string Host
|
|
{
|
|
get
|
|
{
|
|
if (Match == UriMatchType.RegularExpression)
|
|
{
|
|
return null;
|
|
}
|
|
if (_host == null && Uri != null)
|
|
{
|
|
_host = CoreHelpers.GetHost(Uri);
|
|
if (_host == string.Empty)
|
|
{
|
|
_host = null;
|
|
}
|
|
}
|
|
return _host;
|
|
}
|
|
}
|
|
|
|
public string HostOrUri => Host ?? Uri;
|
|
|
|
public bool IsWebsite => Uri != null && (Uri.StartsWith("http://") || Uri.StartsWith("https://") ||
|
|
(Uri.Contains("://") && Regex.IsMatch(Uri, CoreHelpers.TldEndingRegex)));
|
|
|
|
public bool CanLaunch
|
|
{
|
|
get
|
|
{
|
|
if (_canLaunch != null)
|
|
{
|
|
return _canLaunch.Value;
|
|
}
|
|
if (Uri != null && Match != UriMatchType.RegularExpression)
|
|
{
|
|
var uri = LaunchUri;
|
|
_canLaunch = _canLaunchWhitelist.Any(prefix => uri.StartsWith(prefix));
|
|
return _canLaunch.Value;
|
|
}
|
|
_canLaunch = false;
|
|
return _canLaunch.Value;
|
|
}
|
|
}
|
|
|
|
public string LaunchUri => !Uri.Contains("://") && Regex.IsMatch(Uri, CoreHelpers.TldEndingRegex) ?
|
|
string.Concat("http://", Uri) : Uri;
|
|
}
|
|
}
|