From 8a403492c0ee652d539746b71a5fc16c3bff449e Mon Sep 17 00:00:00 2001 From: Nanda Vikas Konduru <34337075+nandavikas@users.noreply.github.com> Date: Sat, 27 Apr 2024 16:06:34 +0200 Subject: [PATCH] fix: symbolRegex in isStrongPassword to include '\' (#2278) * Modified symbolRegex in isStrongPassword to include '\' * Modify test to check validity of strong password with \ character --- src/lib/isStrongPassword.js | 2 +- test/validators.test.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/isStrongPassword.js b/src/lib/isStrongPassword.js index 5db901fa3..8fe9223b7 100644 --- a/src/lib/isStrongPassword.js +++ b/src/lib/isStrongPassword.js @@ -4,7 +4,7 @@ import assertString from './util/assertString'; const upperCaseRegex = /^[A-Z]$/; const lowerCaseRegex = /^[a-z]$/; const numberRegex = /^[0-9]$/; -const symbolRegex = /^[-#!$@£%^&*()_+|~=`{}\[\]:";'<>?,.\/ ]$/; +const symbolRegex = /^[-#!$@£%^&*()_+|~=`{}\[\]:";'<>?,.\/\\ ]$/; const defaultOptions = { minLength: 8, diff --git a/test/validators.test.js b/test/validators.test.js index 2810a1c37..a2942f32c 100644 --- a/test/validators.test.js +++ b/test/validators.test.js @@ -13020,6 +13020,7 @@ describe('Validators', () => { '+&DxJ=X7-4L8jRCD', 'etV*p%Nr6w&H%FeF', '£3.ndSau_7', + 'VaLIDWith\\Symb0l', ], invalid: [ '',