Files
hive/generate_password_hash.py
anthonyrawlins 268214d971 Major WHOOSH system refactoring and feature enhancements
- Migrated from HIVE branding to WHOOSH across all components
- Enhanced backend API with new services: AI models, BZZZ integration, templates, members
- Added comprehensive testing suite with security, performance, and integration tests
- Improved frontend with new components for project setup, AI models, and team management
- Updated MCP server implementation with WHOOSH-specific tools and resources
- Enhanced deployment configurations with production-ready Docker setups
- Added comprehensive documentation and setup guides
- Implemented age encryption service and UCXL integration

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-27 08:34:48 +10:00

40 lines
1.4 KiB
Python

#!/usr/bin/env python3
"""
Generate password hash for WHOOSH admin user
Uses the same passlib configuration as the backend
"""
import subprocess
import sys
try:
from passlib.context import CryptContext
except ImportError:
print("❌ passlib not installed. Installing...")
subprocess.run([sys.executable, "-m", "pip", "install", "passlib[bcrypt]"])
from passlib.context import CryptContext
# Same configuration as backend
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
# Generate hash for the new password
password = "whooshadmin123"
hashed = pwd_context.hash(password)
print(f"Original password: {password}")
print(f"Generated hash: {hashed}")
# Verify it works
verified = pwd_context.verify(password, hashed)
print(f"Verification test: {'✅ PASS' if verified else '❌ FAIL'}")
# Test against old password
old_hash = "$2b$12$EjRUdYXNPgnveP6mgFY00uOj.fBp6u/9ZKqCZPdL4RK7QWg1Tpvp2"
old_password_test = pwd_context.verify("whooshadmin", old_hash)
print(f"Old password 'whooshadmin' verification: {'✅ PASS' if old_password_test else '❌ FAIL'}")
new_password_test = pwd_context.verify("whooshadmin123", old_hash)
print(f"New password 'whooshadmin123' against old hash: {'✅ PASS' if new_password_test else '❌ FAIL (expected)'}")
print(f"\nSQL UPDATE command:")
print(f"UPDATE users SET hashed_password = '{hashed}' WHERE username = 'admin';")