Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions com-dict-client/src/components/Login/loginForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ const NormalLoginForm = () => {
<Form.Item
name="email"
rules={[
{
type: "email",
message: "The input is not a valid Email address!",
},
{
required: true,
message: "Please input your Email Address!",
Expand Down
44 changes: 44 additions & 0 deletions com-dict-client/src/components/Signup/SignUp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
>
Expand Down