Files
moto-adv-website/migrations/add_password_reset_system.py
ske087 30bd4c62ad Major Feature Update: Modern Chat System & Admin Management
Features Added:
🔥 Modern Chat System:
- Real-time messaging with modern Tailwind CSS design
- Post-linked discussions for adventure sharing
- Chat categories (general, technical-support, adventure-planning)
- Mobile-responsive interface with gradient backgrounds
- JavaScript polling for live message updates

🎯 Comprehensive Admin Panel:
- Chat room management with merge capabilities
- Password reset system with email templates
- User management with admin controls
- Chat statistics and analytics dashboard
- Room binding to posts and categorization

�� Mobile API Integration:
- RESTful API endpoints at /api/v1/chat
- Session-based authentication for mobile apps
- Comprehensive endpoints for rooms, messages, users
- Mobile app compatibility (React Native, Flutter)

🛠️ Technical Improvements:
- Enhanced database models with ChatRoom categories
- Password reset token system with email verification
- Template synchronization fixes for Docker deployment
- Migration scripts for database schema updates
- Improved error handling and validation

🎨 UI/UX Enhancements:
- Modern card-based layouts matching app design
- Consistent styling across chat and admin interfaces
- Mobile-optimized touch interactions
- Professional gradient designs and glass morphism effects

📚 Documentation:
- Updated README with comprehensive API documentation
- Added deployment instructions for Docker (port 8100)
- Configuration guide for production environments
- Mobile integration examples and endpoints

This update transforms the platform into a comprehensive motorcycle adventure community with modern chat capabilities and professional admin management tools.
2025-08-10 00:22:33 +03:00

67 lines
2.0 KiB
Python

#!/usr/bin/env python3
"""
Database migration script for Password Reset System
Adds PasswordResetRequest and PasswordResetToken tables
"""
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from app.extensions import db
from app.models import PasswordResetRequest, PasswordResetToken
from config import Config
def create_password_reset_tables():
"""Create password reset tables"""
try:
# Create tables
db.create_all()
print("✅ Password reset tables created successfully!")
# Verify tables exist
from sqlalchemy import inspect
inspector = inspect(db.engine)
tables = inspector.get_table_names()
if 'password_reset_request' in tables:
print("✅ PasswordResetRequest table exists")
else:
print("❌ PasswordResetRequest table missing")
if 'password_reset_token' in tables:
print("✅ PasswordResetToken table exists")
else:
print("❌ PasswordResetToken table missing")
return True
except Exception as e:
print(f"❌ Error creating tables: {e}")
return False
def main():
"""Main migration function"""
print("🔄 Starting password reset system migration...")
# Import app to initialize database
from run import app
with app.app_context():
success = create_password_reset_tables()
if success:
print("✅ Migration completed successfully!")
print("\nNew features available:")
print("- Admin can view password reset requests")
print("- Admin can generate secure reset tokens")
print("- Email templates for manual sending")
print("- Token usage tracking")
print("- Request status management")
else:
print("❌ Migration failed!")
sys.exit(1)
if __name__ == '__main__':
main()