fix: 添加密码修改调试日志

This commit is contained in:
菜鸟生产 2026-03-18 13:38:03 +08:00
parent b490043f2e
commit 2a4e3514ef
2 changed files with 14 additions and 3 deletions

View File

@ -2,7 +2,7 @@
# Version Configuration for Zodiac Collection Management System
# 当前版本号 (语义化版本:主版本。次版本.修订版)
VERSION=1.1.3
VERSION=1.1.4
# 版本代号 (可选)
VERSION_CODENAME="新生"

View File

@ -110,6 +110,11 @@ export default function Settings() {
setError('')
setSuccess('')
if (!passwordForm.oldPassword) {
setError('请输入当前密码')
return
}
if (passwordForm.newPassword !== passwordForm.confirmPassword) {
setError('两次输入的密码不一致')
return
@ -121,8 +126,10 @@ export default function Settings() {
}
setSaving(true)
console.log('开始修改密码...')
try {
console.log('发送请求到 /api/auth/change-password')
const res = await fetch('/api/auth/change-password', {
method: 'POST',
headers: {
@ -135,12 +142,16 @@ export default function Settings() {
})
})
console.log('响应状态:', res.status)
const data = await res.json()
console.log('响应数据:', data)
if (res.ok) {
setSuccess('密码修改成功!')
setPasswordForm({ oldPassword: '', newPassword: '', confirmPassword: '' })
} else {
const data = await res.json()
setError(data.error?.message || '密码修改失败')
setError(data.error?.message || data.detail || '密码修改失败')
}
}
} catch (e) {
setError('密码修改失败,请重试')