1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-29 12:45:20 +01:00

take whole otpauth URI

This commit is contained in:
Kyle Spearrin 2019-06-05 00:41:12 -04:00
parent c3f91761f6
commit 67da9387ff

View File

@ -51,8 +51,15 @@ namespace Bit.App.Pages
// Stop analysis until we navigate away so we don't keep reading barcodes
_zxing.IsAnalyzing = false;
_zxing.IsScanning = false;
if(!string.IsNullOrWhiteSpace(result?.Text) &&
Uri.TryCreate(result.Text, UriKind.Absolute, out Uri uri) &&
var text = result?.Text;
if(!string.IsNullOrWhiteSpace(text))
{
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('&');
@ -65,6 +72,7 @@ namespace Bit.App.Pages
}
}
}
}
_callback(null);
}
}