File size: 1,008 Bytes
ac90985
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python3
from app.core.database import SessionLocal
from app.models.user import User
from app.core.security import get_password_hash, verify_password

def debug_users():
    db = SessionLocal()
    users = db.query(User).all()
    
    print("📊 Users in database:")
    for user in users:
        print(f"ID: {user.id}, Email: {user.email}, Hash: {user.hashed_password[:20]}...")
    
    # Test password verification
    if users:
        test_user = users[-1]  # Get last user
        test_password = "test123"
        hash_result = get_password_hash(test_password)
        verify_result = verify_password(test_password, test_user.hashed_password)
        
        print(f"\n🔐 Password Test for {test_user.email}:")
        print(f"Test password: {test_password}")
        print(f"New hash: {hash_result}")
        print(f"Stored hash: {test_user.hashed_password}")
        print(f"Verification result: {verify_result}")
    
    db.close()

if __name__ == "__main__":
    debug_users()