Skip to content

Commit

Permalink
Done
Browse files Browse the repository at this point in the history
  • Loading branch information
GOURAVSINGH19 committed May 13, 2024
1 parent 1107e5c commit 7ae3e88
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
10 changes: 5 additions & 5 deletions src/pages/SignIn/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ const SignIn = () => {
});


const checkInputs = (username, password) => {
if (username.trim() == '' && password.trim() == ''){
const checkInputs = (email, password) => {
if (email.trim() !== '' && password.trim() !== ''){
setIsDisabled(false);
}else {
setIsDisabled(true);
Expand Down Expand Up @@ -88,14 +88,14 @@ const SignIn = () => {
errors.password = !validatePassword(value) ? "Password is required" : "";
}

setInputErrors(errors);
setFormFields((prevFormFields) => ({
...prevFormFields,
[name]: value,
}));
checkInputs(formFields.email, formFields.password);
checkInputs(formFields.email, formFields.password,value);


setInputErrors(errors);
};

const signIn = () => {
Expand Down Expand Up @@ -215,7 +215,7 @@ const SignIn = () => {
type={showPassword === false ? "password" : "text"}
name="password"
placeholder="Password"
className="w-[100%]"
className="w-100"
onChange={onChangeField}
value={formFields.password}
autoComplete="current-password"
Expand Down
27 changes: 14 additions & 13 deletions src/pages/SignUp/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ const SignUp = () => {
confirmPassword: "",
});

const checkInputs = (username, password) => {
if (username.trim() === '' && password.trim() === ''){
const checkInputs = (email, password, confirmPassword) => {
if (email.trim() !== '' && password.trim() !== '' && confirmPassword.trim() !== '') {
setIsDisabled(false);
}else {
} else {
setIsDisabled(true);
}
};


const signUp = () => {
setShowLoader(true);
Expand Down Expand Up @@ -96,7 +96,7 @@ const SignUp = () => {

//Password Validation
const validatePassword = (password, error) => {
if (password.length < 8) {
if (password.length < 6) {
error.password = "Password must be at least 6 characters long";
return false;
}
Expand Down Expand Up @@ -134,8 +134,7 @@ const SignUp = () => {
const name = e.target.name;
const value = e.target.value;
let errors = { ...InputErrors };
checkInputs(e.target.value, password);
checkInputs(username, e.target.value);




Expand All @@ -153,10 +152,12 @@ const SignUp = () => {
}

setInputErrors(errors);
setFormFields(() => ({
...formFields,
setFormFields((prevFormFields) => ({
...prevFormFields,
[name]: value,
}));
checkInputs(formFields.email, formFields.password,value);


};

Expand Down Expand Up @@ -226,7 +227,6 @@ const SignUp = () => {
onChange={onChangeField}
value={formFields.email}
autoComplete="email"
error={InputErrors.email}
/>
{InputErrors.email && (
<Typography
Expand All @@ -237,17 +237,17 @@ const SignUp = () => {
</Typography>
)}
</div>
<div className="form-group mb-4 ">
<div className="form-group mb-4 w-100">
<div className="position-relative ">
<TextField
id="password"
type={showPassword === false ? "password" : "text"}
name="password"
placeholder="Password"
className="w-100"
onChange={onChangeField}
value={formFields.password}
autoComplete="new-password"
error={InputErrors.password}
/>
<Button
className="icon"
Expand All @@ -270,13 +270,14 @@ const SignUp = () => {
</div>
</div>

<div className="form-group mb-4 ">
<div className="form-group mb-4 w-100">
<div className="position-relative">
<TextField
id="confirmPassword"
type={showPassword1 === false ? "password" : "text"}
name="confirmPassword"
placeholder="Confirm Password"
className="w-100"
onChange={onChangeField}
value={formFields.confirmPassword}
autoComplete="new-password"
Expand Down

0 comments on commit 7ae3e88

Please sign in to comment.