chore: 添加项目 .gitignore 和整理工具文件
- 新增 .gitignore:忽略备份、临时文件、IDE配置等 - 创建 backups/ 目录:存放数据库备份 - 创建 tools/ 目录:存放实用脚本(reset_passwords.py) - 移动文件到相应目录 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
0a09097095
commit
0809a43349
95
.gitignore
vendored
95
.gitignore
vendored
@ -1,41 +1,70 @@
|
|||||||
# Logs
|
# === 操作系统 ===
|
||||||
logs
|
.DS_Store
|
||||||
|
.DS_Store?
|
||||||
|
._*
|
||||||
|
.Spotlight-V100
|
||||||
|
.Trashes
|
||||||
|
ehthumbs.db
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# === 备份文件 ===
|
||||||
|
backups/
|
||||||
|
*.sql
|
||||||
|
*.db
|
||||||
|
|
||||||
|
# === IDE 和编辑器 ===
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
*~
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
.settings/
|
||||||
|
|
||||||
|
# === Python ===
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
*.pyo
|
||||||
|
*.pyd
|
||||||
|
.Python
|
||||||
|
venv/
|
||||||
|
env/
|
||||||
|
ENV/
|
||||||
|
|
||||||
|
# === Node.js ===
|
||||||
|
node_modules/
|
||||||
|
dist/
|
||||||
|
build/
|
||||||
*.log
|
*.log
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
pnpm-debug.log*
|
|
||||||
lerna-debug.log*
|
|
||||||
pnpm-lock.yaml
|
|
||||||
*/node_modules
|
|
||||||
*/uploads
|
|
||||||
*/dist/*
|
|
||||||
dist
|
|
||||||
*/dist
|
|
||||||
dist.zip
|
|
||||||
dist-ssr
|
|
||||||
*.local
|
|
||||||
package-lock.json
|
package-lock.json
|
||||||
*/package-lock.json
|
|
||||||
# Editor directories and files
|
|
||||||
.vscode/*
|
|
||||||
!.vscode/extensions.json
|
|
||||||
.idea
|
|
||||||
.DS_Store
|
|
||||||
*.suo
|
|
||||||
*.ntvs*
|
|
||||||
*.njsproj
|
|
||||||
*.sln
|
|
||||||
*.sw?
|
|
||||||
|
|
||||||
/auto-imports.d.ts
|
# === Java ===
|
||||||
/components.d.ts
|
|
||||||
/typed-router.d.ts
|
|
||||||
/locale.d.ts
|
|
||||||
|
|
||||||
stats.html
|
|
||||||
*.class
|
|
||||||
target/
|
target/
|
||||||
|
*.class
|
||||||
|
*.jar
|
||||||
|
*.war
|
||||||
|
*.ear
|
||||||
|
|
||||||
# 前端生成的 OpenAPI 文档(由 api:fetch 生成)
|
# === 测试结果 ===
|
||||||
reading-platform-frontend/openapi.json
|
screenshots/
|
||||||
|
*.png
|
||||||
|
*.webm
|
||||||
|
test-results/
|
||||||
|
playwright-report/
|
||||||
|
|
||||||
|
# === 临时文件 ===
|
||||||
|
*.tmp
|
||||||
|
*.temp
|
||||||
|
*.bak
|
||||||
|
*.swp
|
||||||
|
.cache/
|
||||||
|
|
||||||
|
# === 上传文件 ===
|
||||||
|
uploads/
|
||||||
|
|
||||||
|
# === 文档生成 ===
|
||||||
|
docs/node_modules/
|
||||||
|
|||||||
62
tools/reset_passwords.py
Normal file
62
tools/reset_passwords.py
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Reset all user passwords to 123456"""
|
||||||
|
|
||||||
|
import bcrypt
|
||||||
|
import mysql.connector
|
||||||
|
|
||||||
|
DB_CONFIG = {
|
||||||
|
'host': '8.148.151.56',
|
||||||
|
'port': 3306,
|
||||||
|
'user': 'root',
|
||||||
|
'password': 'reading_platform_pwd',
|
||||||
|
'database': 'reading_platform',
|
||||||
|
'charset': 'utf8mb4'
|
||||||
|
}
|
||||||
|
|
||||||
|
def main():
|
||||||
|
print("=" * 60)
|
||||||
|
print("Reset All User Passwords to '123456'")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
# Generate BCrypt hash for 123456
|
||||||
|
password = "123456"
|
||||||
|
salt = bcrypt.gensalt(rounds=10)
|
||||||
|
password_hash = bcrypt.hashpw(password.encode('utf-8'), salt).decode('utf-8')
|
||||||
|
|
||||||
|
print(f"\nNew BCrypt hash for '123456':")
|
||||||
|
print(f"{password_hash}")
|
||||||
|
print()
|
||||||
|
|
||||||
|
conn = mysql.connector.connect(**DB_CONFIG)
|
||||||
|
cursor = conn.cursor()
|
||||||
|
|
||||||
|
# Update admin_users
|
||||||
|
print("Updating admin_users...")
|
||||||
|
cursor.execute("UPDATE admin_users SET password = %s", (password_hash,))
|
||||||
|
print(f" Updated {cursor.rowcount} rows")
|
||||||
|
|
||||||
|
# Update tenants
|
||||||
|
print("Updating tenants...")
|
||||||
|
cursor.execute("UPDATE tenants SET password = %s", (password_hash,))
|
||||||
|
print(f" Updated {cursor.rowcount} rows")
|
||||||
|
|
||||||
|
# Update teachers
|
||||||
|
print("Updating teachers...")
|
||||||
|
cursor.execute("UPDATE teachers SET password = %s", (password_hash,))
|
||||||
|
print(f" Updated {cursor.rowcount} rows")
|
||||||
|
|
||||||
|
# Update parents
|
||||||
|
print("Updating parents...")
|
||||||
|
cursor.execute("UPDATE parents SET password = %s", (password_hash,))
|
||||||
|
print(f" Updated {cursor.rowcount} rows")
|
||||||
|
|
||||||
|
conn.commit()
|
||||||
|
|
||||||
|
print()
|
||||||
|
print("All passwords reset to '123456' successfully!")
|
||||||
|
|
||||||
|
cursor.close()
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
Loading…
Reference in New Issue
Block a user