diff --git a/web/src/components/ChangePasswordDialog.tsx b/web/src/components/ChangePasswordDialog.tsx index a565d045..83c24032 100644 --- a/web/src/components/ChangePasswordDialog.tsx +++ b/web/src/components/ChangePasswordDialog.tsx @@ -17,7 +17,7 @@ const validateConfig: ValidatorConfig = { type Props = DialogProps; const ChangePasswordDialog: React.FC = ({ destroy }: Props) => { - const { t, locale } = useI18n(); + const { t } = useI18n(); const [newPassword, setNewPassword] = useState(""); const [newPasswordAgain, setNewPasswordAgain] = useState(""); @@ -53,7 +53,7 @@ const ChangePasswordDialog: React.FC = ({ destroy }: Props) => { const passwordValidResult = validate(newPassword, validateConfig); if (!passwordValidResult.result) { - toastHelper.error(t("common.password") + locale === "zh" ? "" : " " + passwordValidResult.reason); + toastHelper.error(`${t("common.password")} ${passwordValidResult.reason}`); return; } @@ -63,7 +63,7 @@ const ChangePasswordDialog: React.FC = ({ destroy }: Props) => { id: user.id, password: newPassword, }); - toastHelper.info(t("common.password") + t("common.changed")); + toastHelper.info(t("message.password-changed")); handleCloseBtnClick(); } catch (error: any) { console.error(error); @@ -74,7 +74,7 @@ const ChangePasswordDialog: React.FC = ({ destroy }: Props) => { return ( <>
-

{t("common.password" + " " + t("common.change"))}

+

{t("setting.account-section.change-password")}

diff --git a/web/src/components/Settings/MyAccountSection.tsx b/web/src/components/Settings/MyAccountSection.tsx index fca19ba4..b67c4aaf 100644 --- a/web/src/components/Settings/MyAccountSection.tsx +++ b/web/src/components/Settings/MyAccountSection.tsx @@ -58,6 +58,12 @@ const MyAccountSection = () => { title: "Reset Open API", content: "❗️The existing API will be invalidated and a new one will be generated, are you sure you want to reset?", style: "warning", + onConfirm: async () => { + await userService.patchUser({ + id: user.id, + resetOpenId: true, + }); + }, }); }; diff --git a/web/src/locales/en.json b/web/src/locales/en.json index a16a1a66..71eb5a6a 100644 --- a/web/src/locales/en.json +++ b/web/src/locales/en.json @@ -99,7 +99,8 @@ "member": "Member", "member-list": "Member list", "account-section": { - "title": "Account Information" + "title": "Account Information", + "change-password": "Change password" }, "preference-section": { "default-memo-visibility": "Default memo visibility", @@ -128,6 +129,7 @@ "fill-form": "Please fill out this form", "login-failed": "Login failed", "signup-failed": "Signup failed", - "user-not-found": "User not found" + "user-not-found": "User not found", + "password-changed": "Password Changed" } } diff --git a/web/src/locales/vi.json b/web/src/locales/vi.json index 45ce32de..d7dde537 100644 --- a/web/src/locales/vi.json +++ b/web/src/locales/vi.json @@ -99,7 +99,8 @@ "member": "Thành viên", "member-list": "Danh sách thành viên", "account-section": { - "title": "Thông tin tài khoản" + "title": "Thông tin tài khoản", + "change-password": "đổi mật khẩu" }, "preference-section": { "default-memo-visibility": "Chế độ memo mặc định", @@ -128,6 +129,7 @@ "fill-form": "Please fill out this form", "login-failed": "Đăng nhập thất bại", "signup-failed": "Đăng ký thất bại", - "user-not-found": "Không tìm thấy người dùng này" + "user-not-found": "Không tìm thấy người dùng này", + "password-changed": "mật khẩu đã được thay đổi" } } diff --git a/web/src/locales/zh.json b/web/src/locales/zh.json index 921c2797..35fe871f 100644 --- a/web/src/locales/zh.json +++ b/web/src/locales/zh.json @@ -99,7 +99,8 @@ "member": "成员", "member-list": "成员列表", "account-section": { - "title": "账号信息" + "title": "账号信息", + "change-password": "修改密码" }, "preference-section": { "default-memo-visibility": "默认 Memo 可见性", @@ -128,6 +129,7 @@ "fill-form": "请填写此表单", "login-failed": "登录失败", "signup-failed": "注册失败", - "user-not-found": "未找到用户" + "user-not-found": "未找到用户", + "password-changed": "密码已修改" } }