private async Task NextAsync() { try { await ButtonSpinner.SpinAsync(async() => { var user = await ApplicationUserService.GetUserByEmailAsync(UserEmailModel.Email); if (user == null) { ValidationErrorMessage.DisplayError(nameof(UserEmailModel.Email), HESException.GetMessage(HESCode.UserNotFound)); return; } PasswordSignInModel.Email = UserEmailModel.Email; HasSecurityKey = (await Fido2Service.GetCredentialsByUserEmail(UserEmailModel.Email)).Count > 0; AuthenticationStep = AuthenticationStep.EnterPassword; }); } catch (HESException ex) { ValidationErrorMessage.DisplayError(nameof(UserEmailModel.Email), ex.Message); } catch (Exception ex) { Logger.LogError(ex.Message); SetErrorMessage(ex.Message); } }
private async Task EditAccountPasswordAsync() { try { await ButtonSpinner.SpinAsync(async() => { using (TransactionScope transactionScope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled)) { await EmployeeService.EditPersonalAccountPwdAsync(Account, AccountPassword); if (AccountPassword.UpdateActiveDirectoryPassword) { await LdapService.SetUserPasswordAsync(Account.EmployeeId, AccountPassword.Password, LdapSettings); } transactionScope.Complete(); } RemoteDeviceConnectionsService.StartUpdateHardwareVaultAccounts(await EmployeeService.GetEmployeeVaultIdsAsync(Account.EmployeeId)); await ToastService.ShowToastAsync("Account password updated.", ToastType.Success); await ModalDialogClose(); }); } catch (Exception ex) { Logger.LogError(ex.Message); await ToastService.ShowToastAsync(ex.Message, ToastType.Error); await ModalDialogClose(); } }
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(); } }
private async Task EditAsync() { try { await ButtonSpinner.SpinAsync(async() => { await OrgStructureService.EditDepartmentAsync(Department); await ToastService.ShowToastAsync("Department updated.", ToastType.Success); await Refresh.InvokeAsync(this); await SynchronizationService.UpdateOrgSructureCompanies(ExceptPageId); await ModalDialogService.CloseAsync(); }); } catch (AlreadyExistException ex) { ValidationErrorMessage.DisplayError(nameof(Department.Name), ex.Message); } catch (Exception ex) { Logger.LogError(ex.Message); await ToastService.ShowToastAsync(ex.Message, ToastType.Error); await ModalDialogService.CloseAsync(); } }
private async Task EditAccountOtpAsync() { try { await ButtonSpinner.SpinAsync(async() => { await EmployeeService.EditPersonalAccountOtpAsync(Account, _accountOtp); RemoteDeviceConnectionsService.StartUpdateHardwareVaultAccounts(await EmployeeService.GetEmployeeVaultIdsAsync(Account.EmployeeId)); await ToastService.ShowToastAsync("Account OTP updated.", ToastType.Success); await SynchronizationService.UpdateEmployeeDetails(ExceptPageId, Account.EmployeeId); await ModalDialogService.CloseAsync(); }); } catch (IncorrectOtpException ex) { ValidationErrorMessage.DisplayError(nameof(AccountOtp.OtpSecret), ex.Message); } catch (Exception ex) { Logger.LogError(ex.Message); await ToastService.ShowToastAsync(ex.Message, ToastType.Error); await ModalDialogService.CloseAsync(); } }
private async Task FilterAsync() { await ButtonSpinner.SpinAsync(async() => { await FilterChanged.Invoke(Filter); }); }
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(); } }
private async Task EditAccountAsync() { try { await ButtonSpinner.SpinAsync(async() => { await EmployeeService.EditPersonalAccountAsync(PersonalAccount); RemoteDeviceConnectionsService.StartUpdateHardwareVaultAccounts(await EmployeeService.GetEmployeeVaultIdsAsync(PersonalAccount.EmployeeId)); await ToastService.ShowToastAsync("Account updated.", ToastType.Success); await ModalDialogClose(); }); } catch (HESException ex) when(ex.Code == HESCode.AccountExist) { ValidationErrorMessage.DisplayError(nameof(Account.Name), ex.Message); } catch (HESException ex) when(ex.Code == HESCode.IncorrectUrl) { ValidationErrorMessage.DisplayError(nameof(Account.Urls), ex.Message); } catch (Exception ex) { Logger.LogError(ex.Message); await ToastService.ShowToastAsync(ex.Message, ToastType.Error); await ModalDialogCancel(); } }
private async Task EditRenewLicenseOrderAsync() { try { await ButtonSpinner.SpinAsync(async() => { if (_renewLicenseOrder.EndDate < DateTime.Now) { ValidationErrorMessage.DisplayError(nameof(RenewLicenseOrder.EndDate), $"End Date must not be less than Start Date."); return; } if (!_renewLicenseOrder.HardwareVaults.Where(x => x.Checked).Any()) { ValidationErrorMessage.DisplayError(nameof(RenewLicenseOrder.HardwareVaults), $"Select at least one hardware vault."); return; } var checkedHardwareVaults = _renewLicenseOrder.HardwareVaults.Where(x => x.Checked).ToList(); var maxEndDate = checkedHardwareVaults.Select(x => x.LicenseEndDate).Max(); if (_renewLicenseOrder.EndDate < maxEndDate) { ValidationErrorMessage.DisplayError(nameof(RenewLicenseOrder.HardwareVaults), $"The selected End Date less than max end date for selected hardware vaults."); return; } LicenseOrder.ContactEmail = _renewLicenseOrder.ContactEmail; LicenseOrder.Note = _renewLicenseOrder.Note; LicenseOrder.ProlongExistingLicenses = true; LicenseOrder.StartDate = null; LicenseOrder.EndDate = _renewLicenseOrder.EndDate.Date; await LicenseService.EditOrderAsync(LicenseOrder, checkedHardwareVaults); await SynchronizationService.UpdateLicenses(ExceptPageId); await ToastService.ShowToastAsync("Order created.", ToastType.Success); await ModalDialogService.CloseAsync(); }); } catch (Exception ex) { Logger.LogError(ex.Message); await ToastService.ShowToastAsync(ex.Message, ToastType.Error); await ModalDialogService.CloseAsync(); } }
private async Task EditAsync() { try { await ButtonSpinner.SpinAsync(async() => { await HardwareVaultService.UpdateRfidAsync(HardwareVault); await ToastService.ShowToastAsync("RFID updated.", ToastType.Success); await ModalDialogClose(); }); } catch (Exception ex) { Logger.LogError(ex.Message); await ToastService.ShowToastAsync(ex.Message, ToastType.Error); await ModalDialogCancel(); } }
private async Task UpdateLicensingSettingsAsync() { try { await ButtonSpinner.SpinAsync(async() => { await AppSettingsService.SetLicensingSettingsAsync(LicensingSettings); await ToastService.ShowToastAsync("License settings updated.", ToastType.Success); await SynchronizationService.UpdateParameters(ExceptPageId); await ModalDialogService.CloseAsync(); }); } catch (Exception ex) { Logger.LogError(ex.Message); await ToastService.ShowToastAsync(ex.Message, ToastType.Error); await ModalDialogService.CloseAsync(); } }
private async Task CreateProfileAsync() { try { await ButtonSpinner.SpinAsync(async() => { await HardwareVaultService.CreateProfileAsync(AccessProfile); await ToastService.ShowToastAsync("Hardware vault profile created.", ToastType.Success); await SynchronizationService.UpdateHardwareVaultProfiles(ExceptPageId); await ModalDialogService.CloseAsync(); }); } catch (Exception ex) { Logger.LogError(ex.Message); await ToastService.ShowToastAsync(ex.Message, ToastType.Error); await ModalDialogService.CancelAsync(); } }
private async Task EditAsync() { try { await ButtonSpinner.SpinAsync(async() => { await EmployeeService.EditEmployeeAsync(Employee); await ToastService.ShowToastAsync("Employee updated.", ToastType.Success); await ModalDialogClose(); }); } catch (AlreadyExistException ex) { ValidationErrorMessage.DisplayError(nameof(Employee.FirstName), ex.Message); } catch (Exception ex) { Logger.LogError(ex.Message); await ToastService.ShowToastAsync(ex.Message, ToastType.Error); await ModalDialogCancel(); } }
private async Task LoginWithPasswordAsync() { try { await ButtonSpinner.SpinAsync(async() => { var response = await IdentityApiClient.LoginWithPasswordAsync(PasswordSignInModel); response.ThrowIfFailed(); if (response.Succeeded) { NavigationManager.NavigateTo(Routes.Dashboard, true); return; } if (response.RequiresTwoFactor) { NavigationManager.NavigateTo($"{Routes.LoginWith2Fa}?returnUrl={ReturnUrl}", true); return; } if (response.IsLockedOut) { NavigationManager.NavigateTo(Routes.Lockout, true); return; } }); } catch (HESException ex) when(ex.Code == HESCode.InvalidLoginAttempt) { ValidationErrorMessage.DisplayError(nameof(PasswordSignInModel.Password), HESException.GetMessage(ex.Code)); } catch (Exception ex) { Logger.LogError(ex.Message); SetErrorMessage(ex.Message); } }
private async Task EditAsync() { try { await ButtonSpinner.SpinAsync(async() => { await GroupService.EditGroupAsync(Group); await ToastService.ShowToastAsync("Group updated.", ToastType.Success); await SynchronizationService.UpdateGroups(ExceptPageId); await ModalDialogService.CloseAsync(); }); } catch (AlreadyExistException ex) { ValidationErrorMessage.DisplayError(nameof(Core.Entities.Group.Name), ex.Message); } catch (Exception ex) { Logger.LogError(ex.Message); await ToastService.ShowToastAsync(ex.Message, ToastType.Error); await ModalDialogService.CancelAsync(); } }