feat(auth): implement password reset with Google Authenticator verification (#537)

实现忘记密码功能,用户可以通过邮箱和Google Authenticator验证码重置密码。

**后端改动:**
- 添加 `/api/reset-password` 接口
- 实现 `UpdateUserPassword` 数据库方法
- 验证邮箱、OTP和新密码

**前端改动:**
- 新增 `ResetPasswordPage` 组件
- 在登录页面添加"忘记密码"链接
- 实现密码重置表单(新密码、确认密码、OTP验证)
- 添加密码可见性切换功能
- 支持中英文国际化

**安全特性:**
- 要求Google Authenticator验证
- 密码强度验证(最少6位)
- 密码确认匹配检查
- 密码哈希存储

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Sue
2025-11-05 21:01:18 +08:00
committed by GitHub
parent eb515d74e9
commit db68689475
8 changed files with 329 additions and 0 deletions

View File

@@ -336,6 +336,14 @@ export const translations = {
forgotPassword: 'Forgot password?',
rememberMe: 'Remember me',
otpCode: 'OTP Code',
resetPassword: 'Reset Password',
resetPasswordTitle: 'Reset your password',
newPassword: 'New Password',
newPasswordPlaceholder: 'Enter new password (at least 6 characters)',
resetPasswordButton: 'Reset Password',
resetPasswordSuccess: 'Password reset successful! Please login with your new password',
resetPasswordFailed: 'Password reset failed',
backToLogin: 'Back to Login',
scanQRCode: 'Scan QR Code',
enterOTPCode: 'Enter 6-digit OTP code',
verifyOTP: 'Verify OTP',
@@ -811,6 +819,14 @@ export const translations = {
loginNow: '立即登录',
forgotPassword: '忘记密码?',
rememberMe: '记住我',
resetPassword: '重置密码',
resetPasswordTitle: '重置您的密码',
newPassword: '新密码',
newPasswordPlaceholder: '请输入新密码至少6位',
resetPasswordButton: '重置密码',
resetPasswordSuccess: '密码重置成功!请使用新密码登录',
resetPasswordFailed: '密码重置失败',
backToLogin: '返回登录',
otpCode: 'OTP验证码',
scanQRCode: '扫描二维码',
enterOTPCode: '输入6位OTP验证码',