Skip to content

Commit 983925a

Browse files
authored
Merge pull request #3 from rbvwolf/feat/security-limits
feat: Security limits enhanced
2 parents 5abd72f + 0243b66 commit 983925a

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/Validator.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ class Validator {
44
validateName(name) {
55
if (!name || name.trim() === ""){
66
return false;}
7+
if (name.length > 50)
8+
return false;
79
const nameRegex = /^[a-zA-ZğüşıöçĞÜŞİÖÇ\s]+$/;
810
return nameRegex.test(name);
911
}

tests/Validator.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,8 @@ describe('Create New Account - Validation Tests', () => {
130130
expect(validator.validateDateOfBirth('15/00/2000')).toBe(false);
131131
});
132132

133+
test('26. BVA / Security - Name exceeding 50 characters should fail', () => {
134+
const LongestName = "A".repeat(51);
135+
expect(validator.validateName(LongestName)).toBe(false);
136+
});
133137
});

0 commit comments

Comments
 (0)