mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 15:15:34 +03:00
load login page after registration completed
This commit is contained in:
parent
2d6407f9a0
commit
7de33d1c60
3 changed files with 22 additions and 8 deletions
|
@ -89,7 +89,14 @@ namespace Bit.App.Pages
|
||||||
|
|
||||||
public async Task RegisterAsync()
|
public async Task RegisterAsync()
|
||||||
{
|
{
|
||||||
await Navigation.PushModalAsync(new ExtendedNavigationPage(new RegisterPage()));
|
await Navigation.PushModalAsync(new ExtendedNavigationPage(new RegisterPage(this)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task DismissRegisterAndLoginAsync(string email)
|
||||||
|
{
|
||||||
|
await Navigation.PopModalAsync();
|
||||||
|
await Navigation.PushModalAsync(new ExtendedNavigationPage(new LoginPage(email)));
|
||||||
|
_userDialogs.Toast("Your new account has been created! You may now log in.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,11 @@ namespace Bit.App.Pages
|
||||||
private ISyncService _syncService;
|
private ISyncService _syncService;
|
||||||
private ISettings _settings;
|
private ISettings _settings;
|
||||||
private IGoogleAnalyticsService _googleAnalyticsService;
|
private IGoogleAnalyticsService _googleAnalyticsService;
|
||||||
|
private readonly string _email;
|
||||||
|
|
||||||
public LoginPage()
|
public LoginPage(string email = null)
|
||||||
{
|
{
|
||||||
|
_email = email;
|
||||||
_cryptoService = Resolver.Resolve<ICryptoService>();
|
_cryptoService = Resolver.Resolve<ICryptoService>();
|
||||||
_authService = Resolver.Resolve<IAuthService>();
|
_authService = Resolver.Resolve<IAuthService>();
|
||||||
_deviceInfo = Resolver.Resolve<IDeviceInfo>();
|
_deviceInfo = Resolver.Resolve<IDeviceInfo>();
|
||||||
|
@ -54,7 +56,11 @@ namespace Bit.App.Pages
|
||||||
containerPadding: padding);
|
containerPadding: padding);
|
||||||
|
|
||||||
var lastLoginEmail = _settings.GetValueOrDefault<string>(Constants.LastLoginEmail);
|
var lastLoginEmail = _settings.GetValueOrDefault<string>(Constants.LastLoginEmail);
|
||||||
if(!string.IsNullOrWhiteSpace(lastLoginEmail))
|
if(!string.IsNullOrWhiteSpace(_email))
|
||||||
|
{
|
||||||
|
EmailCell.Entry.Text = _email;
|
||||||
|
}
|
||||||
|
else if(!string.IsNullOrWhiteSpace(lastLoginEmail))
|
||||||
{
|
{
|
||||||
EmailCell.Entry.Text = lastLoginEmail;
|
EmailCell.Entry.Text = lastLoginEmail;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,9 +17,11 @@ namespace Bit.App.Pages
|
||||||
private IUserDialogs _userDialogs;
|
private IUserDialogs _userDialogs;
|
||||||
private IAccountsApiRepository _accountsApiRepository;
|
private IAccountsApiRepository _accountsApiRepository;
|
||||||
private IGoogleAnalyticsService _googleAnalyticsService;
|
private IGoogleAnalyticsService _googleAnalyticsService;
|
||||||
|
private HomePage _homePage;
|
||||||
|
|
||||||
public RegisterPage()
|
public RegisterPage(HomePage homePage)
|
||||||
{
|
{
|
||||||
|
_homePage = homePage;
|
||||||
_cryptoService = Resolver.Resolve<ICryptoService>();
|
_cryptoService = Resolver.Resolve<ICryptoService>();
|
||||||
_userDialogs = Resolver.Resolve<IUserDialogs>();
|
_userDialogs = Resolver.Resolve<IUserDialogs>();
|
||||||
_accountsApiRepository = Resolver.Resolve<IAccountsApiRepository>();
|
_accountsApiRepository = Resolver.Resolve<IAccountsApiRepository>();
|
||||||
|
@ -148,14 +150,14 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
if(string.IsNullOrWhiteSpace(EmailCell.Entry.Text))
|
if(string.IsNullOrWhiteSpace(EmailCell.Entry.Text))
|
||||||
{
|
{
|
||||||
await DisplayAlert(AppResources.AnErrorHasOccurred,
|
await DisplayAlert(AppResources.AnErrorHasOccurred,
|
||||||
string.Format(AppResources.ValidationFieldRequired, AppResources.EmailAddress), AppResources.Ok);
|
string.Format(AppResources.ValidationFieldRequired, AppResources.EmailAddress), AppResources.Ok);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(string.IsNullOrWhiteSpace(PasswordCell.Entry.Text))
|
if(string.IsNullOrWhiteSpace(PasswordCell.Entry.Text))
|
||||||
{
|
{
|
||||||
await DisplayAlert(AppResources.AnErrorHasOccurred,
|
await DisplayAlert(AppResources.AnErrorHasOccurred,
|
||||||
string.Format(AppResources.ValidationFieldRequired, "Your Name"), AppResources.Ok);
|
string.Format(AppResources.ValidationFieldRequired, "Your Name"), AppResources.Ok);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -184,9 +186,8 @@ namespace Bit.App.Pages
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_userDialogs.Toast("Your new account has been created! You may now log in.");
|
|
||||||
_googleAnalyticsService.TrackAppEvent("Registered");
|
_googleAnalyticsService.TrackAppEvent("Registered");
|
||||||
await Navigation.PopModalAsync();
|
await _homePage.DismissRegisterAndLoginAsync(EmailCell.Entry.Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class FormTableView : ExtendedTableView
|
private class FormTableView : ExtendedTableView
|
||||||
|
|
Loading…
Reference in a new issue