mirror of
https://github.com/bitwarden/mobile.git
synced 2024-12-18 15:37:42 +01:00
2fa for email
This commit is contained in:
parent
58d101659a
commit
786f3b4644
@ -36,6 +36,7 @@
|
||||
StyleClass="box-label" />
|
||||
<Entry
|
||||
Text="{Binding Token}"
|
||||
x:Name="_totpEntry"
|
||||
Keyboard="Numeric"
|
||||
StyleClass="box-value" />
|
||||
</StackLayout>
|
||||
@ -109,6 +110,10 @@
|
||||
Margin="10, 20, 10, 10"
|
||||
HorizontalTextAlignment="Center" />
|
||||
</StackLayout>
|
||||
<Button Text="{u:I18n SendVerificationCodeAgain}"
|
||||
IsVisible="{Binding EmailMethod}"
|
||||
Clicked="ResendEmail_Clicked"
|
||||
Margin="10, 0"></Button>
|
||||
<Button Text="{u:I18n UseAnotherTwoStepMethod}"
|
||||
Clicked="Methods_Clicked"
|
||||
Margin="10, 0"></Button>
|
||||
|
@ -67,6 +67,10 @@ namespace Bit.App.Pages
|
||||
await LoadOnAppearedAsync(_scrollView, true, () =>
|
||||
{
|
||||
_vm.Init();
|
||||
if(_vm.TotpMethod)
|
||||
{
|
||||
RequestFocus(_totpEntry);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
});
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace Bit.App.Pages
|
||||
|
||||
private bool _u2fSupported = false;
|
||||
private TwoFactorProviderType? _selectedProviderType;
|
||||
private string _twoFactorEmail;
|
||||
private string _totpInstruction;
|
||||
private string _webVaultUrl = "https://vault.bitwarden.com";
|
||||
|
||||
public TwoFactorPageViewModel()
|
||||
@ -44,10 +44,10 @@ namespace Bit.App.Pages
|
||||
PageTitle = AppResources.TwoStepLogin;
|
||||
}
|
||||
|
||||
public string TwoFactorEmail
|
||||
public string TotpInstruction
|
||||
{
|
||||
get => _twoFactorEmail;
|
||||
set => SetProperty(ref _twoFactorEmail, value);
|
||||
get => _totpInstruction;
|
||||
set => SetProperty(ref _totpInstruction, value);
|
||||
}
|
||||
|
||||
public bool Remember { get; set; }
|
||||
@ -65,9 +65,6 @@ namespace Bit.App.Pages
|
||||
|
||||
public bool TotpMethod => AuthenticatorMethod || EmailMethod;
|
||||
|
||||
public string TotpInstruction => AuthenticatorMethod ? AppResources.EnterVerificationCodeApp :
|
||||
AppResources.EnterVerificationCodeEmail;
|
||||
|
||||
public string YubikeyInstruction => Device.RuntimePlatform == Device.iOS ? AppResources.YubiKeyInstructionIos :
|
||||
AppResources.YubiKeyInstruction;
|
||||
|
||||
@ -81,7 +78,6 @@ namespace Bit.App.Pages
|
||||
nameof(YubikeyMethod),
|
||||
nameof(AuthenticatorMethod),
|
||||
nameof(TotpMethod),
|
||||
nameof(TotpInstruction)
|
||||
});
|
||||
}
|
||||
|
||||
@ -141,12 +137,16 @@ namespace Bit.App.Pages
|
||||
});
|
||||
break;
|
||||
case TwoFactorProviderType.Email:
|
||||
TwoFactorEmail = providerData["Email"] as string;
|
||||
TotpInstruction = string.Format(AppResources.EnterVerificationCodeEmail,
|
||||
providerData["Email"] as string);
|
||||
if(_authService.TwoFactorProvidersData.Count > 1)
|
||||
{
|
||||
var emailTask = Task.Run(() => SendEmailAsync(false, false));
|
||||
}
|
||||
break;
|
||||
case TwoFactorProviderType.Authenticator:
|
||||
TotpInstruction = AppResources.EnterVerificationCodeApp;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -212,9 +212,15 @@ namespace Bit.App.Pages
|
||||
{
|
||||
_platformUtilsService.LaunchUri("https://help.bitwarden.com/article/lost-two-step-device/");
|
||||
}
|
||||
else
|
||||
else if(method != AppResources.Cancel)
|
||||
{
|
||||
SelectedProviderType = supportedProviders.FirstOrDefault(p => p.Name == method)?.Type;
|
||||
var selected = supportedProviders.FirstOrDefault(p => p.Name == method)?.Type;
|
||||
if(selected == SelectedProviderType)
|
||||
{
|
||||
// Nothing changed
|
||||
return;
|
||||
}
|
||||
SelectedProviderType = selected;
|
||||
Load();
|
||||
}
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ namespace Bit.Core.Services
|
||||
|
||||
public void Init()
|
||||
{
|
||||
TwoFactorProviders[TwoFactorProviderType.Email].Name = _i18nService.T("EmailTitle");
|
||||
TwoFactorProviders[TwoFactorProviderType.Email].Name = _i18nService.T("Email");
|
||||
TwoFactorProviders[TwoFactorProviderType.Email].Description = _i18nService.T("EmailDesc");
|
||||
TwoFactorProviders[TwoFactorProviderType.Authenticator].Name = _i18nService.T("AuthenticatorAppTitle");
|
||||
TwoFactorProviders[TwoFactorProviderType.Authenticator].Description =
|
||||
|
Loading…
Reference in New Issue
Block a user