pounce/backend/scripts/reset_admin_password.py
yves.gugger a9b5cc0f82 Implement Domain Health Engine + Password Reset
🏥 DOMAIN HEALTH ENGINE (from analysis_2.md):
- New service: backend/app/services/domain_health.py
- 4-layer analysis:
  1. DNS: Nameservers, MX records, A records, parking NS detection
  2. HTTP: Status codes, content, parking keyword detection
  3. SSL: Certificate validity, expiration date, issuer
  4. (WHOIS via existing domain_checker)

📊 HEALTH SCORING:
- Score 0-100 based on all layers
- Status: HEALTHY (🟢), WEAKENING (🟡), PARKED (🟠), CRITICAL (🔴)
- Signals and recommendations for each domain

🔌 API ENDPOINTS:
- GET /api/v1/domains/{id}/health - Full health report
- POST /api/v1/domains/health-check?domain=x - Quick check any domain

🔐 PASSWORD RESET:
- New script: backend/scripts/reset_admin_password.py
- guggeryves@hotmail.com password: Pounce2024!

PARKING DETECTION:
- Known parking nameservers (Sedo, Afternic, etc.)
- Page content keywords ('buy this domain', 'for sale', etc.)
2025-12-10 09:34:43 +01:00

58 lines
1.5 KiB
Python

#!/usr/bin/env python3
"""
Script to reset admin password.
"""
import asyncio
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent))
from sqlalchemy import select
from passlib.context import CryptContext
from app.database import AsyncSessionLocal
from app.models.user import User
ADMIN_EMAIL = "guggeryves@hotmail.com"
NEW_PASSWORD = "Pounce2024!" # Strong password
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
async def reset_password():
"""Reset admin password."""
print(f"🔐 Resetting password for: {ADMIN_EMAIL}")
async with AsyncSessionLocal() as db:
result = await db.execute(
select(User).where(User.email == ADMIN_EMAIL)
)
user = result.scalar_one_or_none()
if not user:
print(f"❌ User not found: {ADMIN_EMAIL}")
return False
# Hash new password
hashed = pwd_context.hash(NEW_PASSWORD)
user.hashed_password = hashed
user.is_verified = True
user.is_active = True
user.is_admin = True
await db.commit()
print(f"✅ Password reset successful!")
print(f"\n📋 LOGIN CREDENTIALS:")
print(f" Email: {ADMIN_EMAIL}")
print(f" Password: {NEW_PASSWORD}")
print(f"\n⚠️ Please change this password after logging in!")
return True
if __name__ == "__main__":
asyncio.run(reset_password())