From 4ec329afbc415732cf8d8cd8284afaa355dffc84 Mon Sep 17 00:00:00 2001 From: Furrium Network Date: Sun, 9 Aug 2026 23:41:36 +0800 Subject: [PATCH] Update api.js --- js/api.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/js/api.js b/js/api.js index 494f63f..042bcd8 100644 --- a/js/api.js +++ b/js/api.js @@ -329,5 +329,31 @@ const API = { }); if (data.error) throw new Error(data.error); return data; + }, + + // ============================================================ + // 恢复码 + // ============================================================ + async generateRecoveryCodes() { + const data = await apiFetch('/auth/recovery-codes/generate', { + method: 'POST' + }); + if (data.error) throw new Error(data.error); + return data; + }, + + async getRecoveryCodesCount() { + const data = await apiFetch('/auth/recovery-codes/count'); + if (data.error) throw new Error(data.error); + return data; + }, + + async resetPassword(email, recoveryCode, newPassword) { + const data = await apiFetch('/auth/reset-password', { + method: 'POST', + body: JSON.stringify({ email, recoveryCode, newPassword }) + }); + if (data.error) throw new Error(data.error); + return data; } };