mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 15:15:34 +03:00
take whole otpauth URI
This commit is contained in:
parent
c3f91761f6
commit
67da9387ff
1 changed files with 16 additions and 8 deletions
|
@ -51,8 +51,15 @@ namespace Bit.App.Pages
|
||||||
// Stop analysis until we navigate away so we don't keep reading barcodes
|
// Stop analysis until we navigate away so we don't keep reading barcodes
|
||||||
_zxing.IsAnalyzing = false;
|
_zxing.IsAnalyzing = false;
|
||||||
_zxing.IsScanning = false;
|
_zxing.IsScanning = false;
|
||||||
if(!string.IsNullOrWhiteSpace(result?.Text) &&
|
var text = result?.Text;
|
||||||
Uri.TryCreate(result.Text, UriKind.Absolute, out Uri uri) &&
|
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))
|
!string.IsNullOrWhiteSpace(uri?.Query))
|
||||||
{
|
{
|
||||||
var queryParts = uri.Query.Substring(1).ToLowerInvariant().Split('&');
|
var queryParts = uri.Query.Substring(1).ToLowerInvariant().Split('&');
|
||||||
|
@ -65,6 +72,7 @@ namespace Bit.App.Pages
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
_callback(null);
|
_callback(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue