From 628ac46a892095bb4be458da5b9c50a8935205ea Mon Sep 17 00:00:00 2001 From: Wang Sijie Date: Fri, 1 Jul 2022 14:41:45 +0800 Subject: [PATCH] fix(console): reset password label (#1300) --- .../src/pages/UserDetails/components/CreateSuccess.tsx | 9 ++++++--- packages/console/src/pages/UserDetails/index.tsx | 1 + packages/phrases/src/locales/en.ts | 1 + packages/phrases/src/locales/zh-cn.ts | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/console/src/pages/UserDetails/components/CreateSuccess.tsx b/packages/console/src/pages/UserDetails/components/CreateSuccess.tsx index 8cd2165be..14aa874b4 100644 --- a/packages/console/src/pages/UserDetails/components/CreateSuccess.tsx +++ b/packages/console/src/pages/UserDetails/components/CreateSuccess.tsx @@ -17,9 +17,10 @@ type Props = { password: string; title: AdminConsoleKey; onClose: () => void; + passwordLabel?: string; }; -const CreateSuccess = ({ username, password, title, onClose }: Props) => { +const CreateSuccess = ({ username, password, title, onClose, passwordLabel }: Props) => { const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' }); const [passwordVisible, setPasswordVisible] = useState(false); @@ -28,7 +29,9 @@ const CreateSuccess = ({ username, password, title, onClose }: Props) => { return null; } await navigator.clipboard.writeText( - `User username: ${username}\nInitial password: ${password}` + `${t('user_details.created_username')} ${username}\n${ + passwordLabel ?? t('user_details.created_password') + } ${password}` ); toast.success(t('general.copied')); }; @@ -56,7 +59,7 @@ const CreateSuccess = ({ username, password, title, onClose }: Props) => {
{username}
-
{t('user_details.created_password')}
+
{passwordLabel ?? t('user_details.created_password')}
{passwordVisible ? password : password.replace(/./g, '*')}
diff --git a/packages/console/src/pages/UserDetails/index.tsx b/packages/console/src/pages/UserDetails/index.tsx index 660a4723d..bd3125dea 100644 --- a/packages/console/src/pages/UserDetails/index.tsx +++ b/packages/console/src/pages/UserDetails/index.tsx @@ -304,6 +304,7 @@ const UserDetails = () => { title="user_details.reset_password.congratulations" username={data.username ?? '-'} password={resetResult} + passwordLabel={t('user_details.reset_password.new_password')} onClose={() => { setResetResult(undefined); }} diff --git a/packages/phrases/src/locales/en.ts b/packages/phrases/src/locales/en.ts index d4423848c..49c533a61 100644 --- a/packages/phrases/src/locales/en.ts +++ b/packages/phrases/src/locales/en.ts @@ -266,6 +266,7 @@ const translation = { title: 'Are you sure you want to reset the password?', content: "This action cannot be undone. This will reset the user's log in information.", congratulations: 'This user has been reset', + new_password: 'New password:', }, tab_logs: 'User logs', field_email: 'Primary email', diff --git a/packages/phrases/src/locales/zh-cn.ts b/packages/phrases/src/locales/zh-cn.ts index e9432b145..d728c6989 100644 --- a/packages/phrases/src/locales/zh-cn.ts +++ b/packages/phrases/src/locales/zh-cn.ts @@ -260,6 +260,7 @@ const translation = { title: '确定要重置密码?', content: '本操作不可撤销,将会重置用户的登录信息。', congratulations: '该用户已被重置', + new_password: '新密码:', }, tab_logs: '用户日志', field_email: '主要邮箱',