diff --git a/src/App/Pages/Accounts/TwoFactorPage.xaml b/src/App/Pages/Accounts/TwoFactorPage.xaml index 06f5ac2a2..04c5a67fd 100644 --- a/src/App/Pages/Accounts/TwoFactorPage.xaml +++ b/src/App/Pages/Accounts/TwoFactorPage.xaml @@ -124,6 +124,10 @@ IsVisible="{Binding EmailMethod}" Clicked="ResendEmail_Clicked" Margin="10, 0"> + diff --git a/src/App/Pages/Accounts/TwoFactorPage.xaml.cs b/src/App/Pages/Accounts/TwoFactorPage.xaml.cs index 5d448721e..5a7eb2f5a 100644 --- a/src/App/Pages/Accounts/TwoFactorPage.xaml.cs +++ b/src/App/Pages/Accounts/TwoFactorPage.xaml.cs @@ -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); + } + } + } } } diff --git a/src/App/Pages/Accounts/TwoFactorPageViewModel.cs b/src/App/Pages/Accounts/TwoFactorPageViewModel.cs index 094434055..2de247f3e 100644 --- a/src/App/Pages/Accounts/TwoFactorPageViewModel.cs +++ b/src/App/Pages/Accounts/TwoFactorPageViewModel.cs @@ -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; } diff --git a/src/App/Resources/AppResources.Designer.cs b/src/App/Resources/AppResources.Designer.cs index cb9b6e53e..e8bda2641 100644 --- a/src/App/Resources/AppResources.Designer.cs +++ b/src/App/Resources/AppResources.Designer.cs @@ -3580,7 +3580,7 @@ namespace Bit.App.Resources { } /// - /// Looks up a localized string similar to Try Again. + /// Looks up a localized string similar to Try again. /// public static string TryAgain { get { diff --git a/src/App/Resources/AppResources.resx b/src/App/Resources/AppResources.resx index 9fbc08285..35446ef17 100644 --- a/src/App/Resources/AppResources.resx +++ b/src/App/Resources/AppResources.resx @@ -1249,7 +1249,7 @@ Hold your Yubikey near the top of the device. - Try Again + Try again To continue, hold your YubiKey NEO against the back of the device.