1
0
mirror of https://github.com/bitwarden/mobile synced 2026-01-08 03:23:23 +00:00

yubikey fixes for ios

This commit is contained in:
Kyle Spearrin
2019-07-06 21:59:13 -04:00
parent 066b3aba5b
commit eca4777b99
5 changed files with 23 additions and 4 deletions

View File

@@ -124,6 +124,10 @@
IsVisible="{Binding EmailMethod}"
Clicked="ResendEmail_Clicked"
Margin="10, 0"></Button>
<Button Text="{u:I18n TryAgain}"
IsVisible="{Binding ShowTryAgain}"
Clicked="TryAgain_Clicked"
Margin="10, 0"></Button>
<Button Text="{u:I18n UseAnotherTwoStepMethod}"
Clicked="Methods_Clicked"
Margin="10, 0"></Button>

View File

@@ -55,11 +55,12 @@ namespace Bit.App.Pages
{
if(message.Command == "gotYubiKeyOTP")
{
if(_vm.YubikeyMethod)
var token = (string)message.Data;
if(_vm.YubikeyMethod && !string.IsNullOrWhiteSpace(token) && !token.Contains(" "))
{
Device.BeginInvokeOnMainThread(async () =>
{
_vm.Token = (string)message.Data;
_vm.Token = token;
await _vm.SubmitAsync();
});
}
@@ -138,5 +139,16 @@ namespace Bit.App.Pages
await Navigation.PopModalAsync();
}
}
private void TryAgain_Clicked(object sender, EventArgs e)
{
if(DoOnce())
{
if(_vm.YubikeyMethod)
{
_messagingService.Send("listenYubiKeyOTP", true);
}
}
}
}
}

View File

@@ -69,6 +69,8 @@ namespace Bit.App.Pages
public bool TotpMethod => AuthenticatorMethod || EmailMethod;
public bool ShowTryAgain => YubikeyMethod && Device.RuntimePlatform == Device.iOS;
public string YubikeyInstruction => Device.RuntimePlatform == Device.iOS ? AppResources.YubiKeyInstructionIos :
AppResources.YubiKeyInstruction;
@@ -82,6 +84,7 @@ namespace Bit.App.Pages
nameof(YubikeyMethod),
nameof(AuthenticatorMethod),
nameof(TotpMethod),
nameof(ShowTryAgain),
});
}
public Command SubmitCommand { get; }