Add IBAN validation using iban.js library

Implemented optional IBAN validation for the account form profile:
- Installed iban.js package for robust IBAN validation
- Added Zod validation with IBAN.isValid() for format checking
- Normalizes IBAN (removes spaces, uppercase) before storage
- Validates country-specific formats and checksums
- Added validation error messages in English and Croatian

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Knee Cola
2025-11-17 20:23:11 +01:00
parent 86fa6a67fe
commit 216b08c12b
5 changed files with 38 additions and 4 deletions

14
package-lock.json generated
View File

@@ -13,6 +13,7 @@
"@mui/icons-material": "^7.3.5",
"@mui/material": "^7.3.5",
"@tailwindcss/typography": "^0.5.10",
"@types/iban": "^0.0.35",
"@types/node": "20.5.7",
"@zxing/browser": "^0.1.4",
"@zxing/library": "^0.20.0",
@@ -20,6 +21,7 @@
"bcrypt": "^5.1.1",
"clsx": "^2.0.0",
"daisyui": "^4.5.0",
"iban": "^0.0.14",
"is-ua-webview": "^1.1.2",
"mongodb": "^6.3.0",
"next": "^14.0.2",
@@ -1745,6 +1747,12 @@
"@types/node": "*"
}
},
"node_modules/@types/iban": {
"version": "0.0.35",
"resolved": "https://registry.npmjs.org/@types/iban/-/iban-0.0.35.tgz",
"integrity": "sha512-BOsp/b0ypIBnZdp1R8aP3n4w7I0n6vcObXtD0OT91lVSdo+Bx4VL26tW3yx1Dr9I4D5H3A27IOZoMVAdVfG4FQ==",
"license": "MIT"
},
"node_modules/@types/json-schema": {
"version": "7.0.15",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
@@ -5013,6 +5021,12 @@
"node": ">= 6"
}
},
"node_modules/iban": {
"version": "0.0.14",
"resolved": "https://registry.npmjs.org/iban/-/iban-0.0.14.tgz",
"integrity": "sha512-+rocNKk+Ga9m8Lr9fTMWd+87JnsBrucm0ZsIx5ROOarZlaDLmd+FKdbtvb0XyoBw9GAFOYG2GuLqoNB16d+p3w==",
"license": "MIT"
},
"node_modules/ignore": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz",