1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-23 19:53:50 +00:00

load login page after registration

This commit is contained in:
Kyle Spearrin
2019-06-04 23:07:35 -04:00
parent b67adf8789
commit b29ccf67b1
4 changed files with 28 additions and 7 deletions

View File

@@ -5,6 +5,7 @@ using Bit.Core.Enums;
using Bit.Core.Exceptions;
using Bit.Core.Models.Request;
using Bit.Core.Utilities;
using System;
using System.Threading.Tasks;
using Xamarin.Forms;
@@ -16,7 +17,6 @@ namespace Bit.App.Pages
private readonly IApiService _apiService;
private readonly ICryptoService _cryptoService;
private readonly IPlatformUtilsService _platformUtilsService;
private bool _showPassword;
public RegisterPageViewModel()
@@ -26,7 +26,7 @@ namespace Bit.App.Pages
_cryptoService = ServiceContainer.Resolve<ICryptoService>("cryptoService");
_platformUtilsService = ServiceContainer.Resolve<IPlatformUtilsService>("platformUtilsService");
PageTitle = AppResources.Bitwarden;
PageTitle = AppResources.CreateAccount;
TogglePasswordCommand = new Command(TogglePassword);
ToggleConfirmPasswordCommand = new Command(ToggleConfirmPassword);
SubmitCommand = new Command(async () => await SubmitAsync());
@@ -51,6 +51,7 @@ namespace Bit.App.Pages
public string MasterPassword { get; set; }
public string ConfirmMasterPassword { get; set; }
public string Hint { get; set; }
public Action RegistrationSuccess { get; set; }
public async Task SubmitAsync()
{
@@ -121,10 +122,15 @@ namespace Bit.App.Pages
try
{
await _deviceActionService.ShowLoadingAsync(AppResources.LoggingIn);
await _deviceActionService.ShowLoadingAsync(AppResources.CreatingAccount);
await _apiService.PostRegisterAsync(request);
await _deviceActionService.HideLoadingAsync();
// TODO: dismiss this page from home page and pass email for login page
_platformUtilsService.ShowToast("success", null, AppResources.AccountCreated,
new System.Collections.Generic.Dictionary<string, object>
{
["longDuration"] = true
});
RegistrationSuccess?.Invoke();
}
catch(ApiException e)
{