Files
user-system/tools/test_password.py
long-agent 5b6bd93179 refactor: 整理项目根目录结构
整理内容:
- 删除 60+ 临时测试输出文件 (*.txt)
- 移动二进制文件到 bin/ 目录
- 移动 Shell 脚本到 scripts/ 目录
  - scripts/dev/: check_gitea.sh, check_sub2api.sh, run_tests.sh
  - scripts/deploy/: deploy_*.sh, simple_deploy.sh
  - scripts/ops/: fix_nginx.sh, fix_ssl.sh, install_docker.sh
  - scripts/test/: test_*.sh, test_*.bat
- 移动批处理文件到 scripts/
- 移动 Python 脚本到 tools/
- 清理临时日志文件

保留根目录必要文件:
- go.mod, go.sum, go.work
- Makefile, docker-compose.yml
- .env.example, .gitignore
- README.md, AGENTS.md, DEPLOY_GUIDE.md

验证: go build ./... && go test ./... 通过
2026-04-07 18:10:36 +08:00

36 lines
1020 B
Python

# Password verification test - we'll use Go to test this
# First, let's check if the database has the correct password
import sqlite3
import hashlib
conn = sqlite3.connect('d:/project/data/user_management.db')
c = conn.cursor()
# Get admin password hash
c.execute("SELECT password FROM users WHERE username = 'admin'")
row = c.fetchone()
if row:
stored_hash = row[0]
print(f"Stored hash length: {len(stored_hash)}")
print(f"Stored hash: {stored_hash[:80]}...")
# The hash format is: $argon2id$v=19$m=65536,t=3,p=2$<salt>$<hash>
parts = stored_hash.split('$')
print(f"\nHash parts:")
for i, part in enumerate(parts):
print(f" [{i}] {part[:50] if len(part) > 50 else part}")
# Extract parameters
params = parts[3].split(',')
print(f"\nParameters:")
for param in params:
print(f" {param}")
conn.close()
print("\n" + "="*50)
print("The password hash appears to be correct.")
print("The issue might be in the Go verification logic.")
print("="*50)