diff --git a/client/modules/User/components/AccountForm.jsx b/client/modules/User/components/AccountForm.jsx
index 5be633b594..67ba40e2ba 100644
--- a/client/modules/User/components/AccountForm.jsx
+++ b/client/modules/User/components/AccountForm.jsx
@@ -1,4 +1,5 @@
import React from 'react';
+import { useState } from 'react';
import { Form, Field } from 'react-final-form';
import { useSelector, useDispatch } from 'react-redux';
import { useTranslation } from 'react-i18next';
@@ -25,6 +26,17 @@ function asyncValidate(fieldToValidate, value) {
}
function AccountForm() {
+ const [showCurrentPassword, setShowCurrentPassword] = useState(false);
+ const [showNewPassword, setShowNewPassword] = useState(false);
+
+ const toggleCurrentPasswordVisibility = () => {
+ setShowCurrentPassword(!showCurrentPassword);
+ };
+
+ const toggleConfirmPasswordVisibility = () => {
+ setShowNewPassword(!showNewPassword);
+ };
+
const { t } = useTranslation();
const user = useSelector((state) => state.user);
const dispatch = useDispatch();
@@ -134,14 +146,32 @@ function AccountForm() {
-
+
+
+ {
+ if (e.key === 'Enter') {
+ toggleCurrentPasswordVisibility();
+ }
+ }}
+ >
+ {showCurrentPassword
+ ? t('AccountForm.HidePassword')
+ : t('AccountForm.ShowPassword')}
+
+
+
{field.meta.touched && field.meta.error && (
{field.meta.error}
)}
@@ -154,14 +184,32 @@ function AccountForm() {
-
+
+
+ {
+ if (e.key === 'Enter') {
+ toggleConfirmPasswordVisibility();
+ }
+ }}
+ >
+ {showNewPassword
+ ? t('AccountForm.HidePassword')
+ : t('AccountForm.ShowPassword')}
+
+
+
{field.meta.touched && field.meta.error && (
{field.meta.error}
)}
diff --git a/client/modules/User/components/LoginForm.jsx b/client/modules/User/components/LoginForm.jsx
index d990299322..c92420ab21 100644
--- a/client/modules/User/components/LoginForm.jsx
+++ b/client/modules/User/components/LoginForm.jsx
@@ -1,4 +1,5 @@
import React from 'react';
+import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Form, Field } from 'react-final-form';
import { useDispatch } from 'react-redux';
@@ -7,6 +8,8 @@ import { validateLogin } from '../../../utils/reduxFormUtils';
import { validateAndLoginUser } from '../actions';
function LoginForm() {
+ const [showPassword, setShowPassword] = useState(false);
+
const { t } = useTranslation();
const dispatch = useDispatch();
@@ -14,6 +17,10 @@ function LoginForm() {
return dispatch(validateAndLoginUser(formProps));
}
+ const togglePasswordVisibility = () => {
+ setShowPassword(!showPassword);
+ };
+
return (