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 + }}>确定
{ // 個人資料編輯