mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 18:38: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,28 +170,11 @@ namespace Bit.App.Pages
|
||||||
|
|
||||||
private void AddAuthenticationKey_OnClicked(object sender, EventArgs e)
|
private void AddAuthenticationKey_OnClicked(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var text = ViewModel.TotpAuthenticationKey;
|
if (!string.IsNullOrWhiteSpace(ViewModel.TotpAuthenticationKey))
|
||||||
if (!string.IsNullOrWhiteSpace(text))
|
|
||||||
{
|
{
|
||||||
if (text.StartsWith("otpauth://totp"))
|
_callback(ViewModel.TotpAuthenticationKey);
|
||||||
{
|
|
||||||
_callback(text);
|
|
||||||
return;
|
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(null);
|
_callback(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue