mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 02:18:27 +03:00
[SG-599] Cannot read authenticator key if you don't include URI before TOTP Secret. (#2047)
Removed unnecessary code when adding a TOTP auth key secret manually
This commit is contained in:
parent
ecd4da08ee
commit
9163b9e4de
1 changed files with 3 additions and 20 deletions
|
@ -170,27 +170,10 @@ namespace Bit.App.Pages
|
|||
|
||||
private void AddAuthenticationKey_OnClicked(object sender, EventArgs e)
|
||||
{
|
||||
var text = ViewModel.TotpAuthenticationKey;
|
||||
if (!string.IsNullOrWhiteSpace(text))
|
||||
if (!string.IsNullOrWhiteSpace(ViewModel.TotpAuthenticationKey))
|
||||
{
|
||||
if (text.StartsWith("otpauth://totp"))
|
||||
{
|
||||
_callback(text);
|
||||
return;
|
||||
}
|
||||
else if (Uri.TryCreate(text, UriKind.Absolute, out Uri uri) &&
|
||||
!string.IsNullOrWhiteSpace(uri?.Query))
|
||||
{
|
||||
var queryParts = uri.Query.Substring(1).ToLowerInvariant().Split('&');
|
||||
foreach (var part in queryParts)
|
||||
{
|
||||
if (part.StartsWith("secret="))
|
||||
{
|
||||
_callback(part.Substring(7)?.ToUpperInvariant());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
_callback(ViewModel.TotpAuthenticationKey);
|
||||
return;
|
||||
}
|
||||
_callback(null);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue