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