| 617 | |
| 618 | // 保存验证码等待配置 |
| 619 | async function handleSaveEmailCode(e) { |
| 620 | e.preventDefault(); |
| 621 | |
| 622 | const timeout = parseInt(document.getElementById('email-code-timeout').value); |
| 623 | const pollInterval = parseInt(document.getElementById('email-code-poll-interval').value); |
| 624 | |
| 625 | // 客户端验证 |
| 626 | if (timeout < 30 || timeout > 600) { |
| 627 | toast.error('等待超时必须在 30-600 秒之间'); |
| 628 | return; |
| 629 | } |
| 630 | if (pollInterval < 1 || pollInterval > 30) { |
| 631 | toast.error('轮询间隔必须在 1-30 秒之间'); |
| 632 | return; |
| 633 | } |
| 634 | |
| 635 | const data = { |
| 636 | timeout: timeout, |
| 637 | poll_interval: pollInterval |
| 638 | }; |
| 639 | |
| 640 | try { |
| 641 | await api.post('/settings/email-code', data); |
| 642 | toast.success('验证码配置已保存'); |
| 643 | } catch (error) { |
| 644 | toast.error('保存失败: ' + error.message); |
| 645 | } |
| 646 | } |
| 647 | |
| 648 | // 备份数据库 |
| 649 | async function handleBackup() { |