From d650360f7809328d51a394d7ce5f12aa09e140d2 Mon Sep 17 00:00:00 2001 From: Piyumi Nadeesha <83717913+PiyumiNadeesha@users.noreply.github.com> Date: Sat, 15 May 2021 08:28:10 +0530 Subject: [PATCH 1/3] Update SignUp.js Increased password complexity with minimum length 8 and mixed character sets (numeric, special, mixed case) --- .../src/components/Signup/SignUp.js | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/com-dict-client/src/components/Signup/SignUp.js b/com-dict-client/src/components/Signup/SignUp.js index b190fc9..d332ad8 100644 --- a/com-dict-client/src/components/Signup/SignUp.js +++ b/com-dict-client/src/components/Signup/SignUp.js @@ -139,6 +139,50 @@ const RegistrationForm = () => { required: true, message: "Please input your password!", }, + ({ getFieldValue }) => ({ + validator(rule, value) { + var c = 0; + if (!value || value.length < 8) { + return Promise.reject("Enter a strong password with minimum 8 characters!"); + } + // check for a number + if (/[0-9]/.test(value) === false) { + c = c + 0; + } + else { + c++; + } + // check for a capital letter + if (/[A-Z]/.test(value) === false) { + c = c + 0; + } + else { + c++; + } + // check for a lowercase letter + if (/[a-z]/.test(value) === false) { + c = c + 0; + } + else { + c++; + } + // check for punctuation mark + if (/[@#$&*^%_!+=\/\\[\]|?.,<>)(;:'"~`]/.test(value) === false) { + c = c + 0; + } + else { + c++; + } + + if (c >= 3) { + return Promise.resolve(); + } + else { + return Promise.reject("The password must contain at least three of these four character categories: English uppercase , English lowercase , Number and Non - alphanumeric"); + } + } + } + ), ]} hasFeedback > From ebad089543f97577d9fc4364b3cb8e48bf81952c Mon Sep 17 00:00:00 2001 From: Piyumi Nadeesha <83717913+PiyumiNadeesha@users.noreply.github.com> Date: Sat, 15 May 2021 08:58:58 +0530 Subject: [PATCH 2/3] Update loginForm.js Added an input validation for email on Sign-up page --- com-dict-client/src/components/Login/loginForm.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/com-dict-client/src/components/Login/loginForm.js b/com-dict-client/src/components/Login/loginForm.js index aa8be62..91ddc79 100644 --- a/com-dict-client/src/components/Login/loginForm.js +++ b/com-dict-client/src/components/Login/loginForm.js @@ -27,6 +27,10 @@ const NormalLoginForm = () => {