claude_dev
|
4723554e29
|
fix(api): auth 用 bcrypt 直调替代 passlib(修复容器 __about__ 缺失致登录失败)
- 替换 passlib.context.CryptContext 为直接 bcrypt 调用
- hash_password: bcrypt.hashpw + gensalt
- verify_password: bcrypt.checkpw + 异常处理
- 保持公共接口不变(hash_password/verify_password/create_token/verify_token)
- 移除 passlib 导入,直接使用 bcrypt 模块
- 现有 $2b$12$... bcrypt hash 仍可验证通过
修复问题:
- passlib 1.7.4 探测 bcrypt.__about__.__version__ 导致 AttributeError
- 现代 bcrypt 移除了 __about__ 属性
- 致使容器内密码验证失败,登录跳过
验证结果:
- 本地 test_auth.py: 3/3 PASS
- 容器 test_auth.py: 3/3 PASS
- 容器 smoke JWT LOGIN: PASS(之前 SKIP)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-07-06 19:55:06 +08:00 |
|