Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix(NewPasswordForm):added-eye-for-confirm-password

Aswin Asok395f1d717311
diff --git a/web/packages/accounts-rs/components/NewPasswordForm.tsx b/web/packages/accounts-rs/components/NewPasswordForm.tsx
index 2d6b23f86a..c8fb35dd7a 100644
--- a/web/packages/accounts-rs/components/NewPasswordForm.tsx
+++ b/web/packages/accounts-rs/components/NewPasswordForm.tsx
@@ -51,11 +51,16 @@ export const NewPasswordForm: React.FC<NewPasswordFormProps> = ({
onSubmit,
}) => {
const [showPassword, setShowPassword] = useState(false);
+ const [showConfirmPassword, setShowConfirmPassword] = useState(false);
const handleToggleShowHidePassword = useCallback(
() => setShowPassword((show) => !show),
[],
);
+ const handleToggleShowHideConfirmPassword = useCallback(
+ () => setShowConfirmPassword((show) => !show),
+ [],
+ );
const formik = useFormik({
initialValues: { password: "", confirmPassword: "" },
@@ -119,7 +124,7 @@ export const NewPasswordForm: React.FC<NewPasswordFormProps> = ({
<TextField
name="confirmPassword"
autoComplete="new-password"
- type="password"
+ type={showConfirmPassword ? "text" : "password"}
label={t("confirm_password")}
value={formik.values.confirmPassword}
onChange={formik.handleChange}
@@ -128,6 +133,18 @@ export const NewPasswordForm: React.FC<NewPasswordFormProps> = ({
helperText={formik.errors.confirmPassword ?? " "}
disabled={formik.isSubmitting}
fullWidth
+ slotProps={{
+ input: {
+ endAdornment: (
+ <ShowHidePasswordInputAdornment
+ showPassword={showConfirmPassword}
+ onToggle={
+ handleToggleShowHideConfirmPassword
+ }
+ />
+ ),
+ },
+ }}
/>
<PasswordStrengthHint password={formik.values.password} />
diff --git a/web/packages/accounts/components/NewPasswordForm.tsx b/web/packages/accounts/components/NewPasswordForm.tsx
index a0be4565f9..5a59ae4aa3 100644
--- a/web/packages/accounts/components/NewPasswordForm.tsx
+++ b/web/packages/accounts/components/NewPasswordForm.tsx
@@ -51,11 +51,16 @@ export const NewPasswordForm: React.FC<NewPasswordFormProps> = ({
onSubmit,
}) => {
const [showPassword, setShowPassword] = useState(false);
+ const [showConfirmPassword, setShowConfirmPassword] = useState(false);
const handleToggleShowHidePassword = useCallback(
() => setShowPassword((show) => !show),
[],
);
+ const handleToggleShowHideConfirmPassword = useCallback(
+ () => setShowConfirmPassword((show) => !show),
+ [],
+ );
const formik = useFormik({
initialValues: { password: "", confirmPassword: "" },
@@ -119,7 +124,7 @@ export const NewPasswordForm: React.FC<NewPasswordFormProps> = ({
<TextField
name="confirmPassword"
autoComplete="new-password"
- type="password"
+ type={showConfirmPassword ? "text" : "password"}
label={t("confirm_password")}
value={formik.values.confirmPassword}
onChange={formik.handleChange}
@@ -128,6 +133,18 @@ export const NewPasswordForm: React.FC<NewPasswordFormProps> = ({
helperText={formik.errors.confirmPassword ?? " "}
disabled={formik.isSubmitting}
fullWidth
+ slotProps={{
+ input: {
+ endAdornment: (
+ <ShowHidePasswordInputAdornment
+ showPassword={showConfirmPassword}
+ onToggle={
+ handleToggleShowHideConfirmPassword
+ }
+ />
+ ),
+ },
+ }}
/>
<PasswordStrengthHint password={formik.values.password} />