From 8c989c112b2265402d7ca2e168dea321872cb14b Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 22 Nov 2025 17:41:58 +0100 Subject: [PATCH] Task/improve validation of currency management in Admin Control panel (#5973) * Improve validation (disallow GBp) * Update changelog --- CHANGELOG.md | 1 + .../create-asset-profile-dialog.component.ts | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df0481c5a..a25101db8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Disabled the action to delete activities if the activities table is empty +- Improved the validation of the currency management in the admin control panel - Resolved the data source of the `GHOSTFOLIO` data provider in the export functionality - Resolved the data source of the `GHOSTFOLIO` data provider in the import functionality - Refreshed the cryptocurrencies list diff --git a/apps/client/src/app/components/admin-market-data/create-asset-profile-dialog/create-asset-profile-dialog.component.ts b/apps/client/src/app/components/admin-market-data/create-asset-profile-dialog/create-asset-profile-dialog.component.ts index 44a0b374b..32e1e3309 100644 --- a/apps/client/src/app/components/admin-market-data/create-asset-profile-dialog/create-asset-profile-dialog.component.ts +++ b/apps/client/src/app/components/admin-market-data/create-asset-profile-dialog/create-asset-profile-dialog.component.ts @@ -107,9 +107,8 @@ export class GfCreateAssetProfileDialogComponent implements OnDestroy, OnInit { symbol: this.createAssetProfileForm.get('searchSymbol').value.symbol }); } else if (this.mode === 'currency') { - const currency = ( - this.createAssetProfileForm.get('addCurrency').value as string - ).toUpperCase(); + const currency = this.createAssetProfileForm.get('addCurrency') + .value as string; const currencies = Array.from( new Set([...this.customCurrencies, currency]) @@ -201,7 +200,10 @@ export class GfCreateAssetProfileDialogComponent implements OnDestroy, OnInit { private iso4217CurrencyCodeValidator(): ValidatorFn { return (control: AbstractControl): ValidationErrors | null => { - if (!isISO4217CurrencyCode(control.value?.toUpperCase())) { + if ( + control.value !== control.value?.toUpperCase() || + !isISO4217CurrencyCode(control.value) + ) { return { invalidCurrency: true }; }