/* * MC Report System * Copyright (C) 2026 Sea Network Technology Studio * Author: CangLan * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ const ForgotPage = { async render() { return `
返回登录
`; }, mount() { document.getElementById('forgot-form').addEventListener('submit', async e => { e.preventDefault(); try { await API.post('/auth/forgot-password', { email: document.getElementById('fg-email').value }); const el = document.getElementById('fg-msg'); el.className = 'alert alert-s'; el.textContent = '如果邮箱已注册,重置链接已发送'; el.classList.remove('hidden'); } catch(ex) { alert(ex.message); } }); } }; const ResetPage = { async render() { const params = new URLSearchParams((location.hash.split('?')[1] || '')); const token = params.get('token'); if (!token) return `
返回登录
`; return `
返回登录
`; }, mount() { const params = new URLSearchParams((location.hash.split('?')[1] || '')); const token = params.get('token'); if (!token) return; document.getElementById('reset-form').addEventListener('submit', async e => { e.preventDefault(); try { await API.post('/auth/reset-password', { token, password: document.getElementById('rs-pwd').value }); const el = document.getElementById('rs-msg'); el.className = 'alert alert-s'; el.textContent = '密码重置成功!请登录'; el.classList.remove('hidden'); setTimeout(() => location.hash = '#/login', 2000); } catch(ex) { const el = document.getElementById('rs-msg'); el.className = 'alert alert-e'; el.textContent = ex.message; el.classList.remove('hidden'); } }); } };