feat: add reset password button in user page (#1742)

This commit is contained in:
Huang Xin
2025-08-04 20:12:19 +08:00
committed by GitHub
parent df9ca2d2fa
commit e3c05e7648
23 changed files with 81 additions and 41 deletions
@@ -477,5 +477,6 @@
"Terms of Service": "شروط الخدمة",
"Privacy Policy": "سياسة الخصوصية",
"Disable Double Click": "تعطيل النقر المزدوج",
"TTS not supported for this document": "تكنولوجيا تحويل النص إلى كلام غير مدعومة لهذا المستند."
}
"TTS not supported for this document": "تكنولوجيا تحويل النص إلى كلام غير مدعومة لهذا المستند.",
"Reset Password": "إعادة تعيين"
}
@@ -461,5 +461,6 @@
"Terms of Service": "Allgemeine Geschäftsbedingungen",
"Privacy Policy": "Datenschutzbestimmungen",
"Disable Double Click": "Doppelklick deaktivieren",
"TTS not supported for this document": "TTS wird für dieses Dokument nicht unterstützt"
}
"TTS not supported for this document": "TTS wird für dieses Dokument nicht unterstützt",
"Reset Password": "Passwort zurücksetzen"
}
@@ -461,5 +461,6 @@
"Terms of Service": "Όροι χρήσης",
"Privacy Policy": "Πολιτική απορρήτου",
"Disable Double Click": "Απενεργοποίηση διπλού κλικ",
"TTS not supported for this document": "Η τεχνολογία TTS δεν υποστηρίζεται για αυτό το έγγραφο."
}
"TTS not supported for this document": "Η τεχνολογία TTS δεν υποστηρίζεται για αυτό το έγγραφο.",
"Reset Password": "Επαναφορά κωδικού"
}
@@ -465,5 +465,6 @@
"Terms of Service": "Condiciones del servicio",
"Privacy Policy": "Política de privacidad",
"Disable Double Click": "Deshabilitar Doble Clic",
"TTS not supported for this document": "TTS no es compatible con este documento."
}
"TTS not supported for this document": "TTS no es compatible con este documento.",
"Reset Password": "Restablecer contraseña"
}
@@ -465,5 +465,6 @@
"Terms of Service": "Conditions d'utilisation",
"Privacy Policy": "Politique de confidentialité",
"Disable Double Click": "Désactiver le double-clic",
"TTS not supported for this document": "TTS non pris en charge pour ce document"
}
"TTS not supported for this document": "TTS non pris en charge pour ce document",
"Reset Password": "Nouveau mot de passe"
}
@@ -461,5 +461,6 @@
"Terms of Service": "सेवा की शर्तें",
"Privacy Policy": "गोपनीयता नीति",
"Disable Double Click": "डबल क्लिक अक्षम करें",
"TTS not supported for this document": "TTS इस दस्तावेज़ के लिए समर्थित नहीं है"
}
"TTS not supported for this document": "TTS इस दस्तावेज़ के लिए समर्थित नहीं है",
"Reset Password": "पासवर्ड रीसेट करें"
}
@@ -457,5 +457,6 @@
"Terms of Service": "Ketentuan Layanan",
"Privacy Policy": "Kebijakan Privasi",
"Disable Double Click": "Nonaktifkan Klik Ganda",
"TTS not supported for this document": "TTS tidak didukung untuk dokumen ini"
}
"TTS not supported for this document": "TTS tidak didukung untuk dokumen ini",
"Reset Password": "Reset Kata Sandi"
}
@@ -465,5 +465,6 @@
"Terms of Service": "Termini di servizio",
"Privacy Policy": "Informativa sulla privacy",
"Disable Double Click": "Disabilita Doppio Clic",
"TTS not supported for this document": "TTS non supportato per questo documento"
}
"TTS not supported for this document": "TTS non supportato per questo documento",
"Reset Password": "Reimposta Password"
}
@@ -457,5 +457,6 @@
"Terms of Service": "利用規約",
"Privacy Policy": "プライバシーポリシー",
"Disable Double Click": "ダブルクリック無効",
"TTS not supported for this document": "TTSはこのドキュメントではサポートされていません"
}
"TTS not supported for this document": "TTSはこのドキュメントではサポートされていません",
"Reset Password": "パスワードをリセット"
}
@@ -457,5 +457,6 @@
"Terms of Service": "서비스 약관",
"Privacy Policy": "개인정보 보호정책",
"Disable Double Click": "더블 클릭 비활성화",
"TTS not supported for this document": "TTS가 이 문서에서 지원되지 않습니다"
}
"TTS not supported for this document": "TTS가 이 문서에서 지원되지 않습니다",
"Reset Password": "비밀번호 재설정"
}
@@ -461,5 +461,6 @@
"Terms of Service": "Gebruiksvoorwaarden",
"Privacy Policy": "Privacybeleid",
"Disable Double Click": "Dubbelklikken uitschakelen",
"TTS not supported for this document": "TTS niet ondersteund voor dit document"
}
"TTS not supported for this document": "TTS niet ondersteund voor dit document",
"Reset Password": "Wachtwoord resetten"
}
@@ -469,5 +469,6 @@
"Terms of Service": "Warunki korzystania z usługi",
"Privacy Policy": "Polityka prywatności",
"Disable Double Click": "Wyłącz podwójne kliknięcie",
"TTS not supported for this document": "TTS nie jest obsługiwane dla tego dokumentu"
}
"TTS not supported for this document": "TTS nie jest obsługiwane dla tego dokumentu",
"Reset Password": "Zresetuj hasło"
}
@@ -465,5 +465,6 @@
"Terms of Service": "Termos de Serviço",
"Privacy Policy": "Política de Privacidade",
"Disable Double Click": "Desativar Clique Duplo",
"TTS not supported for this document": "TTS não suportado para este documento"
}
"TTS not supported for this document": "TTS não suportado para este documento",
"Reset Password": "Redefinir Senha"
}
@@ -469,5 +469,6 @@
"Terms of Service": "Условия использования",
"Privacy Policy": "Политика конфиденциальности",
"Disable Double Click": "Отключить двойной клик",
"TTS not supported for this document": "TTS не поддерживается для этого документа"
}
"TTS not supported for this document": "TTS не поддерживается для этого документа",
"Reset Password": "Сбросить пароль"
}
@@ -457,5 +457,6 @@
"Terms of Service": "ข้อกำหนดในการให้บริการ",
"Privacy Policy": "นโยบายความเป็นส่วนตัว",
"Disable Double Click": "ปิดการคลิกสองครั้ง",
"TTS not supported for this document": "ไม่รองรับ TTS สำหรับเอกสารนี้"
}
"TTS not supported for this document": "ไม่รองรับ TTS สำหรับเอกสารนี้",
"Reset Password": "รีเซ็ตพาสเวิร์ด"
}
@@ -461,5 +461,6 @@
"Terms of Service": "Hizmet Şartları",
"Privacy Policy": "Gizlilik Politikası",
"Disable Double Click": "Çift Tıklamayı Devre Dışı Bırak",
"TTS not supported for this document": "TTS bu belge için desteklenmiyor"
}
"TTS not supported for this document": "TTS bu belge için desteklenmiyor",
"Reset Password": "Şifreyi Sıfırla"
}
@@ -469,5 +469,6 @@
"Terms of Service": "Умови обслуговування",
"Privacy Policy": "Політика конфіденційності",
"Disable Double Click": "Вимкнути подвійне клацання",
"TTS not supported for this document": "TTS не підтримується для цього документа"
}
"TTS not supported for this document": "TTS не підтримується для цього документа",
"Reset Password": "Скинути пароль"
}
@@ -457,5 +457,6 @@
"Terms of Service": "Điều khoản dịch vụ",
"Privacy Policy": "Chính sách bảo mật",
"Disable Double Click": "Tắt Nhấp Đôi",
"TTS not supported for this document": "TTS không được hỗ trợ cho tài liệu này"
}
"TTS not supported for this document": "TTS không được hỗ trợ cho tài liệu này",
"Reset Password": "Đặt lại mật khẩu"
}
@@ -457,5 +457,6 @@
"Terms of Service": "服务条款",
"Privacy Policy": "隐私政策",
"Disable Double Click": "禁用双击",
"TTS not supported for this document": "TTS 不支持此文档"
}
"TTS not supported for this document": "TTS 不支持此文档",
"Reset Password": "重置密码"
}
@@ -457,5 +457,6 @@
"Terms of Service": "服務條款",
"Privacy Policy": "隱私政策",
"Disable Double Click": "禁用雙擊",
"TTS not supported for this document": "TTS 不支援此文件"
}
"TTS not supported for this document": "TTS 不支援此文件",
"Reset Password": "重設密碼"
}
@@ -48,6 +48,7 @@ const DeleteConfirmationModal: React.FC<DeleteConfirmationModalProps> = ({
interface AccountActionsProps {
userPlan: UserPlan;
onLogout: () => void;
onResetPassword: () => void;
onConfirmDelete: () => void;
onRestorePurchase?: () => void;
onManageSubscription?: () => void;
@@ -56,6 +57,7 @@ interface AccountActionsProps {
const AccountActions: React.FC<AccountActionsProps> = ({
userPlan,
onLogout,
onResetPassword,
onConfirmDelete,
onRestorePurchase,
onManageSubscription,
@@ -100,6 +102,12 @@ const AccountActions: React.FC<AccountActionsProps> = ({
</button>
)
)}
<button
onClick={onResetPassword}
className='w-full rounded-lg bg-gray-200 px-6 py-3 font-medium text-gray-800 transition-colors hover:bg-gray-300 md:w-auto'
>
{_('Reset Password')}
</button>
<button
onClick={onLogout}
className='w-full rounded-lg bg-gray-200 px-6 py-3 font-medium text-gray-800 transition-colors hover:bg-gray-300 md:w-auto'
+6 -1
View File
@@ -12,7 +12,7 @@ import { useQuotaStats } from '@/hooks/useQuotaStats';
import { useTranslation } from '@/hooks/useTranslation';
import { useSettingsStore } from '@/store/settingsStore';
import { UserPlan } from '@/types/user';
import { navigateToLibrary } from '@/utils/nav';
import { navigateToLibrary, navigateToResetPassword } from '@/utils/nav';
import { deleteUser } from '@/libs/user';
import { eventDispatcher } from '@/utils/event';
import { getStripe } from '@/libs/stripe/client';
@@ -91,6 +91,10 @@ const ProfilePage = () => {
navigateToLibrary(router);
};
const handleResetPassword = () => {
navigateToResetPassword(router);
};
const handleConfirmDelete = async () => {
try {
await deleteUser();
@@ -388,6 +392,7 @@ const ProfilePage = () => {
<AccountActions
userPlan={userPlan}
onLogout={handleLogout}
onResetPassword={handleResetPassword}
onConfirmDelete={handleConfirmDelete}
onRestorePurchase={handleIAPRestorePurchase}
onManageSubscription={handleManageSubscription}
+7
View File
@@ -83,3 +83,10 @@ export const navigateToLibrary = (
export const redirectToLibrary = () => {
redirect('/library');
};
export const navigateToResetPassword = (router: ReturnType<typeof useRouter>) => {
const pathname = window.location.pathname;
const search = window.location.search;
const currentPath = pathname !== '/auth' ? pathname + search : '/';
router.push(`/auth/recovery?redirect=${encodeURIComponent(currentPath)}`);
};