Skip to content

Commit 6bf8a72

Browse files
author
Apple\Apple
committed
🔧 fix(auth): add copy button to disabled password input in reset confirmation
- Import IconCopy from semi-icons for copy functionality - Replace onClick handler with suffix copy button to fix disabled input issue - Use borderless tertiary button as input suffix for better alignment - Update notification messages formatting (colon spacing) - Ensure password copying works even when input field is disabled
1 parent d3b9319 commit 6bf8a72

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

web/src/components/auth/PasswordResetConfirm.js

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
22
import { API, copy, showError, showNotice, getLogo, getSystemName } from '../../helpers';
33
import { useSearchParams, Link } from 'react-router-dom';
44
import { Button, Card, Form, Typography, Banner } from '@douyinfe/semi-ui';
5-
import { IconMail, IconLock } from '@douyinfe/semi-icons';
5+
import { IconMail, IconLock, IconCopy } from '@douyinfe/semi-icons';
66
import { useTranslation } from 'react-i18next';
77
import Background from '/example.png';
88

@@ -71,7 +71,7 @@ const PasswordResetConfirm = () => {
7171
let password = res.data.data;
7272
setNewPassword(password);
7373
await copy(password);
74-
showNotice(`${t('密码已重置并已复制到剪贴板')}: ${password}`);
74+
showNotice(`${t('密码已重置并已复制到剪贴板')} ${password}`);
7575
} else {
7676
showError(message);
7777
}
@@ -137,11 +137,19 @@ const PasswordResetConfirm = () => {
137137
className="!rounded-md"
138138
disabled={true}
139139
prefix={<IconLock />}
140-
onClick={(e) => {
141-
e.target.select();
142-
navigator.clipboard.writeText(newPassword);
143-
showNotice(`${t('密码已复制到剪贴板')}: ${newPassword}`);
144-
}}
140+
suffix={
141+
<Button
142+
icon={<IconCopy />}
143+
type="tertiary"
144+
theme="borderless"
145+
onClick={async () => {
146+
await copy(newPassword);
147+
showNotice(`${t('密码已复制到剪贴板:')} ${newPassword}`);
148+
}}
149+
>
150+
{t('复制')}
151+
</Button>
152+
}
145153
/>
146154
)}
147155

web/src/i18n/locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,8 @@
265265
"设置页脚": "Set Footer",
266266
"新版本": "New Version",
267267
"关闭": "Close",
268-
"密码已重置并已复制到剪贴板": "Password has been reset and copied to clipboard",
268+
"密码已重置并已复制到剪贴板:": "Password has been reset and copied to clipboard: ",
269+
"密码已复制到剪贴板:": "Password has been copied to clipboard: ",
269270
"密码重置确认": "Password Reset Confirmation",
270271
"邮箱地址": "Email address",
271272
"提交": "Submit",

0 commit comments

Comments
 (0)