51 lines
1.8 KiB
Python
51 lines
1.8 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Manual verification script for User 55 with token 2f39c71d-80f2-44c1-bac4-dab4f384aae8
|
|
"""
|
|
import asyncio
|
|
import sys
|
|
import os
|
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
|
|
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
|
|
from sqlalchemy.orm import sessionmaker
|
|
from app.services.auth_service import AuthService
|
|
from app.core.config import settings
|
|
|
|
async def verify_user_55():
|
|
# Create database connection
|
|
engine = create_async_engine(settings.DATABASE_URL, echo=False)
|
|
async_session = sessionmaker(engine, class_=AsyncSession, expire_on_commit=False)
|
|
|
|
async with async_session() as db:
|
|
print("🔍 Manual verification for User 55")
|
|
print(f"Token: 2f39c71d-80f2-44c1-bac4-dab4f384aae8")
|
|
|
|
# Call the verify_email method
|
|
success = await AuthService.verify_email(db, "2f39c71d-80f2-44c1-bac4-dab4f384aae8")
|
|
|
|
if success:
|
|
print("✅ Email verification successful!")
|
|
|
|
# Check if user is now active
|
|
from sqlalchemy import select
|
|
from app.models.identity import User
|
|
|
|
result = await db.execute(select(User).where(User.id == 55))
|
|
user = result.scalar_one_or_none()
|
|
|
|
if user:
|
|
print(f"User 55 status:")
|
|
print(f" - is_active: {user.is_active}")
|
|
print(f" - email: {user.email}")
|
|
print(f" - person_id: {user.person_id}")
|
|
else:
|
|
print("❌ User 55 not found!")
|
|
else:
|
|
print("❌ Email verification failed - invalid or expired token")
|
|
|
|
return success
|
|
|
|
if __name__ == "__main__":
|
|
result = asyncio.run(verify_user_55())
|
|
sys.exit(0 if result else 1) |