From 3eb7c2ee9e8e34c7928f57fb4208a05b02f2ac1a Mon Sep 17 00:00:00 2001 From: Perminder Singh Date: Fri, 22 Sep 2023 05:23:20 +0530 Subject: [PATCH 1/6] Added eye icon --- client/modules/User/components/LoginForm.jsx | 54 ++++++--- client/modules/User/components/SignupForm.jsx | 109 ++++++++++++------ package-lock.json | 15 +++ package.json | 1 + 4 files changed, 129 insertions(+), 50 deletions(-) diff --git a/client/modules/User/components/LoginForm.jsx b/client/modules/User/components/LoginForm.jsx index d990299322..2d8e756db9 100644 --- a/client/modules/User/components/LoginForm.jsx +++ b/client/modules/User/components/LoginForm.jsx @@ -1,7 +1,8 @@ -import React from 'react'; +import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Form, Field } from 'react-final-form'; import { useDispatch } from 'react-redux'; +import { AiOutlineEye, AiOutlineEyeInvisible } from 'react-icons/ai'; import Button from '../../../common/Button'; import { validateLogin } from '../../../utils/reduxFormUtils'; import { validateAndLoginUser } from '../actions'; @@ -13,6 +14,10 @@ function LoginForm() { function onSubmit(formProps) { return dispatch(validateAndLoginUser(formProps)); } + const [showPassword, setShowPassword] = useState(false); + const handleVisibility = () => { + setShowPassword(!showPassword); + }; return (
{(field) => ( -

- - - {field.meta.touched && field.meta.error && ( - {field.meta.error} - )} -

+
+

+ + + {field.meta.touched && field.meta.error && ( + {field.meta.error} + )} +

+ +
)}
{submitError && !modifiedSinceLastSubmit && ( diff --git a/client/modules/User/components/SignupForm.jsx b/client/modules/User/components/SignupForm.jsx index b80f53f107..8d7a398a5d 100644 --- a/client/modules/User/components/SignupForm.jsx +++ b/client/modules/User/components/SignupForm.jsx @@ -1,7 +1,8 @@ -import React from 'react'; +import { React, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Form, Field } from 'react-final-form'; import { useDispatch } from 'react-redux'; +import { AiOutlineEye, AiOutlineEyeInvisible } from 'react-icons/ai'; import { validateSignup } from '../../../utils/reduxFormUtils'; import { validateAndSignUpUser } from '../actions'; import Button from '../../../common/Button'; @@ -38,6 +39,14 @@ function SignupForm() { function onSubmit(formProps) { return dispatch(validateAndSignUpUser(formProps)); } + const [showPassword, setShowPassword] = useState(false); + const [showConfirmPassword, setShowConfirmPassword] = useState(false); + const handleVisibility = () => { + setShowPassword(!showPassword); + }; + const handleConfirmVisibility = () => { + setShowConfirmPassword(!showConfirmPassword); + }; return ( {(field) => ( -

- - - {field.meta.touched && field.meta.error && ( - {field.meta.error} - )} -

+
+

+ + + {field.meta.touched && field.meta.error && ( + {field.meta.error} + )} +

+ +
)}
{(field) => ( -

- - - {field.meta.touched && field.meta.error && ( - {field.meta.error} - )} -

+
+

+ + + {field.meta.touched && field.meta.error && ( + {field.meta.error} + )} +

+ +
)}
{field.meta.error} )}

- )} diff --git a/client/modules/User/components/SignupForm.jsx b/client/modules/User/components/SignupForm.jsx index f915b21be1..cfe4ea40da 100644 --- a/client/modules/User/components/SignupForm.jsx +++ b/client/modules/User/components/SignupForm.jsx @@ -104,11 +104,22 @@ function SignupForm() { {(field) => ( -
+

+ {field.meta.error} )}

-
)} @@ -144,6 +142,17 @@ function SignupForm() { + {field.meta.error} )}

-
)}
diff --git a/client/styles/components/_forms.scss b/client/styles/components/_forms.scss index 4e92e8fb34..ab0466e6a7 100644 --- a/client/styles/components/_forms.scss +++ b/client/styles/components/_forms.scss @@ -66,13 +66,22 @@ color: getThemifyVariable("form-input-text-color"); background-color: getThemifyVariable("input-background-color"); } - + @media (max-width: 770px) { max-width: 100%; - width:100%; + width: 100%; } } +.form__eye__icon { + font-size: 28px; + position: relative; + top: 5px; + right: -355px; + margin-left: -40px; +} + + .form__input[type='password']::-ms-reveal { display: none; } From aa979aae889c6e4f38e9cd6b25746148c5059492 Mon Sep 17 00:00:00 2001 From: Perminder Singh <127239756+perminder-17@users.noreply.github.com> Date: Fri, 7 Jun 2024 03:09:09 +0530 Subject: [PATCH 4/6] fixes --- client/modules/User/components/SignupForm.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/modules/User/components/SignupForm.jsx b/client/modules/User/components/SignupForm.jsx index cfe4ea40da..61ce2e22f5 100644 --- a/client/modules/User/components/SignupForm.jsx +++ b/client/modules/User/components/SignupForm.jsx @@ -145,9 +145,9 @@ function SignupForm() {