From b1e618e07caa1592036d67dafed064e7797bcd40 Mon Sep 17 00:00:00 2001 From: CrescentLeaf Date: Sun, 26 Oct 2025 21:18:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E5=AF=86=E7=A0=81=20?= =?UTF-8?q?(UI)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/ui/dialog/MyProfileDialog.tsx | 44 +++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/client/ui/dialog/MyProfileDialog.tsx b/client/ui/dialog/MyProfileDialog.tsx index 9aea0fd..f6ef288 100644 --- a/client/ui/dialog/MyProfileDialog.tsx +++ b/client/ui/dialog/MyProfileDialog.tsx @@ -42,6 +42,12 @@ export default function MyProfileDialog({ const editNickNameRef = React.useRef(null) const editUserNameRef = React.useRef(null) + const accountSettingsDialogRef = React.useRef(null) + + const editPasswordDialogRef = React.useRef(null) + const editPasswordOldInputRef = React.useRef(null) + const editPasswordNewInputRef = React.useRef(null) + return (<> { // 公用 - 資料卡 @@ -66,14 +72,10 @@ export default function MyProfileDialog({ userProfileEditDialogRef.current!.open = true}>编辑资料 - 账号设定 + accountSettingsDialogRef.current!.open = true}>账号设定 {/* 隱私設定 */} - dialog({ headline: "退出登录", description: "请确保在退出登录前, 设定了用户名或者已经记录下了用户 ID, 以免无法登录账号", @@ -101,9 +103,35 @@ export default function MyProfileDialog({ { // 账号设定 } - - - userProfileEditDialogRef.current!.open = false}>关闭 + + editPasswordDialogRef.current!.open = true}>修改密码 + accountSettingsDialogRef.current!.open = false}>关闭 + + + +
+ + + editPasswordDialogRef.current!.open = false}>关闭 + { + const re = await Client.invoke("User.resetPassword", { + token: data.access_token, + old_password: CryptoJS.SHA256(editPasswordOldInputRef.current?.value || '').toString(CryptoJS.enc.Hex), + new_password: CryptoJS.SHA256(editPasswordNewInputRef.current?.value || '').toString(CryptoJS.enc.Hex), + }) + + if (checkApiSuccessOrSncakbar(re, "修改失败")) return + snackbar({ + message: "修改成功 (其他客户端需要重新登录)", + placement: "top", + }) + data.access_token = re.data!.access_token as string + data.refresh_token = re.data!.refresh_token as string + data.apply() + editPasswordDialogRef.current!.open = false + }}>确定
{ // 個人資料編輯