customeragent-api / server /scripts /debug_auth.py
anasraza526's picture
Clean deploy to Hugging Face
ac90985
#!/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()