Ejemplo n.º 1
0
        private async Task EditAccoountOtpAsync()
        {
            try
            {
                await ButtonSpinner.SpinAsync(async() =>
                {
                    var vaults = await SharedAccountService.EditSharedAccountOtpAsync(Account, AccountOtp);
                    RemoteDeviceConnectionsService.StartUpdateHardwareVaultAccounts(vaults);
                    await SynchronizationService.UpdateSharedAccounts(ExceptPageId);
                    await ToastService.ShowToastAsync("Account OTP updated.", ToastType.Success);
                    await ModalDialogService.CloseAsync();
                });
            }
            catch (IncorrectOtpException ex)
            {
                ValidationErrorMessage.DisplayError(nameof(SharedAccount.OtpSecret), ex.Message);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CancelAsync();
            }
        }
Ejemplo n.º 2
0
        private async Task CreateAccountAsync()
        {
            try
            {
                await ButtonSpinner.SpinAsync(async() =>
                {
                    await SharedAccountService.CreateSharedAccountAsync(SharedAccount);
                    await ToastService.ShowToastAsync("Account created.", ToastType.Success);
                    await SynchronizationService.UpdateSharedAccounts(ExceptPageId);
                    await ModalDialogService.CloseAsync();
                });
            }
            catch (AlreadyExistException ex)
            {
                ValidationErrorMessage.DisplayError(nameof(SharedAccount.Name), ex.Message);
            }
            catch (IncorrectUrlException ex)
            {
                ValidationErrorMessage.DisplayError(nameof(SharedAccount.Urls), ex.Message);
            }
            catch (IncorrectOtpException ex)
            {
                ValidationErrorMessage.DisplayError(nameof(SharedAccount.OtpSecret), ex.Message);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CloseAsync();
            }
        }
Ejemplo n.º 3
0
        private async Task DeleteAccoountAsync()
        {
            try
            {
                var vaults = await SharedAccountService.DeleteSharedAccountAsync(Account.Id);

                RemoteDeviceConnectionsService.StartUpdateHardwareVaultAccounts(vaults);
                await SynchronizationService.UpdateSharedAccounts(ExceptPageId);

                await ToastService.ShowToastAsync("Account deleted.", ToastType.Success);

                await ModalDialogService.CloseAsync();
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CancelAsync();
            }
        }
        private async Task EditAccoountPasswordAsync()
        {
            try
            {
                await ButtonSpinner.SpinAsync(async() =>
                {
                    var vaults = await SharedAccountService.EditSharedAccountPwdAsync(Account, AccountPassword);
                    RemoteDeviceConnectionsService.StartUpdateHardwareVaultAccounts(vaults);
                    await SynchronizationService.UpdateSharedAccounts(ExceptPageId);
                    await ToastService.ShowToastAsync("Account password updated.", ToastType.Success);
                    await ModalDialogService.CloseAsync();
                });
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CancelAsync();
            }
        }