User verification fix & UI polish
🔧 ADMIN USER FIX: - New script: backend/scripts/verify_admin.py - guggeryves@hotmail.com now verified + admin + Tycoon - Can run manually to fix any user issues 🎨 UI POLISH: - Admin Panel: 'Control Center' → 'Mission Control' - Admin Panel: 'Blog' tab → 'Briefings' tab - Hunter voice consistency throughout The user interface is already professional with: - Collapsible sidebar with badges - Quick search (⌘K) - Notification bell with pulse - Stat cards with hover effects - Activity feed and market pulse - Proper loading states
This commit is contained in:
104
backend/scripts/verify_admin.py
Normal file
104
backend/scripts/verify_admin.py
Normal file
@ -0,0 +1,104 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Script to ensure admin user is properly configured.
|
||||
Run this after database initialization.
|
||||
"""
|
||||
import asyncio
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
|
||||
from sqlalchemy import select, update
|
||||
from app.database import AsyncSessionLocal
|
||||
from app.models.user import User
|
||||
from app.models.subscription import Subscription, SubscriptionTier, SubscriptionStatus, TIER_CONFIG
|
||||
|
||||
|
||||
ADMIN_EMAIL = "guggeryves@hotmail.com"
|
||||
|
||||
|
||||
async def verify_admin():
|
||||
"""Ensure admin user exists and is properly configured."""
|
||||
print(f"🔍 Looking for user: {ADMIN_EMAIL}")
|
||||
|
||||
async with AsyncSessionLocal() as db:
|
||||
# Find user
|
||||
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}")
|
||||
print(" Please register first, then run this script again.")
|
||||
return False
|
||||
|
||||
print(f"✅ User found: ID={user.id}, Name={user.name}")
|
||||
|
||||
# Update user flags
|
||||
changes = []
|
||||
|
||||
if not user.is_admin:
|
||||
user.is_admin = True
|
||||
changes.append("is_admin = True")
|
||||
|
||||
if not user.is_verified:
|
||||
user.is_verified = True
|
||||
changes.append("is_verified = True")
|
||||
|
||||
if not user.is_active:
|
||||
user.is_active = True
|
||||
changes.append("is_active = True")
|
||||
|
||||
if changes:
|
||||
await db.commit()
|
||||
print(f"✅ Updated user: {', '.join(changes)}")
|
||||
else:
|
||||
print("✅ User already has correct flags")
|
||||
|
||||
# Check subscription
|
||||
sub_result = await db.execute(
|
||||
select(Subscription).where(Subscription.user_id == user.id)
|
||||
)
|
||||
subscription = sub_result.scalar_one_or_none()
|
||||
|
||||
if not subscription:
|
||||
# Create Tycoon subscription
|
||||
tycoon_config = TIER_CONFIG.get(SubscriptionTier.TYCOON, {})
|
||||
subscription = Subscription(
|
||||
user_id=user.id,
|
||||
tier=SubscriptionTier.TYCOON,
|
||||
status=SubscriptionStatus.ACTIVE,
|
||||
max_domains=tycoon_config.get("domain_limit", 500),
|
||||
)
|
||||
db.add(subscription)
|
||||
await db.commit()
|
||||
print("✅ Created Tycoon subscription")
|
||||
elif subscription.tier != SubscriptionTier.TYCOON:
|
||||
subscription.tier = SubscriptionTier.TYCOON
|
||||
subscription.status = SubscriptionStatus.ACTIVE
|
||||
subscription.max_domains = TIER_CONFIG.get(SubscriptionTier.TYCOON, {}).get("domain_limit", 500)
|
||||
await db.commit()
|
||||
print("✅ Upgraded to Tycoon subscription")
|
||||
else:
|
||||
print(f"✅ Subscription: {subscription.tier.value} (Active)")
|
||||
|
||||
# Final status
|
||||
print("\n" + "="*50)
|
||||
print("📋 FINAL STATUS:")
|
||||
print(f" Email: {user.email}")
|
||||
print(f" Name: {user.name}")
|
||||
print(f" Admin: {'✅ Yes' if user.is_admin else '❌ No'}")
|
||||
print(f" Verified: {'✅ Yes' if user.is_verified else '❌ No'}")
|
||||
print(f" Active: {'✅ Yes' if user.is_active else '❌ No'}")
|
||||
print(f" Tier: Tycoon")
|
||||
print("="*50)
|
||||
print("\n✅ Admin user is ready! You can now login.")
|
||||
|
||||
return True
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(verify_admin())
|
||||
|
||||
@ -432,7 +432,7 @@ export default function AdminPage() {
|
||||
{ id: 'newsletter' as const, label: 'Newsletter', icon: Mail },
|
||||
{ id: 'tld' as const, label: 'TLD Data', icon: Globe },
|
||||
{ id: 'auctions' as const, label: 'Auctions', icon: Gavel },
|
||||
{ id: 'blog' as const, label: 'Blog', icon: BookOpen },
|
||||
{ id: 'blog' as const, label: 'Briefings', icon: BookOpen },
|
||||
{ id: 'system' as const, label: 'System', icon: Database },
|
||||
{ id: 'activity' as const, label: 'Activity', icon: History },
|
||||
]
|
||||
@ -451,12 +451,12 @@ export default function AdminPage() {
|
||||
<div className="max-w-7xl mx-auto">
|
||||
{/* Header */}
|
||||
<div className="mb-12 animate-fade-in">
|
||||
<span className="text-sm font-semibold text-accent uppercase tracking-wider">Admin Panel</span>
|
||||
<span className="text-sm font-semibold text-accent uppercase tracking-wider">Admin HQ</span>
|
||||
<h1 className="mt-4 font-display text-[2rem] sm:text-[2.75rem] md:text-[3.5rem] leading-[1.1] tracking-[-0.03em] text-foreground">
|
||||
Control Center.
|
||||
Mission Control.
|
||||
</h1>
|
||||
<p className="mt-3 text-lg text-foreground-muted">
|
||||
Manage users, monitor system health, and control platform settings.
|
||||
Users. Data. System. All under your command.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user