0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-06 20:40:08 -05:00

fix(console): reset password label (#1300)

This commit is contained in:
Wang Sijie 2022-07-01 14:41:45 +08:00 committed by GitHub
parent d73663af27
commit 628ac46a89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 3 deletions

View file

@ -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) => {
<div className={styles.infoContent}>{username}</div>
</div>
<div className={styles.infoLine}>
<div>{t('user_details.created_password')}</div>
<div>{passwordLabel ?? t('user_details.created_password')}</div>
<div className={styles.infoContent}>
{passwordVisible ? password : password.replace(/./g, '*')}
</div>

View file

@ -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);
}}

View file

@ -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',

View file

@ -260,6 +260,7 @@ const translation = {
title: '确定要重置密码?',
content: '本操作不可撤销,将会重置用户的登录信息。',
congratulations: '该用户已被重置',
new_password: '新密码:',
},
tab_logs: '用户日志',
field_email: '主要邮箱',