Exemplo n.º 1
0
        private async Task SaveSettingsAsync()
        {
            try
            {
                var isValid = LdapSettingsContext.Validate();

                if (!isValid)
                {
                    return;
                }

                await LdapService.ValidateCredentialsAsync(LdapSettings);

                await AppSettingsService.SetLdapSettingsAsync(LdapSettings);

                await ToastService.ShowToastAsync("Domain settings updated.", ToastType.Success);
                await ModalDialogClose();
            }
            catch (LdapForNet.LdapInvalidCredentialsException)
            {
                ValidationErrorMessage.DisplayError(nameof(LdapSettings.Password), "Invalid password");
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);
                await ModalDialogCancel();
            }
        }