This commit is contained in:
2026-01-16 18:16:33 +08:00
parent 9f3c96ce73
commit e53c3c838c
26 changed files with 1473 additions and 386 deletions

33
backend/verify_login.py Normal file
View File

@@ -0,0 +1,33 @@
from app.models import init_db, SessionLocal
from app.models.user import User
from app.utils.security import verify_password, get_password_hash
def test_login():
db = SessionLocal()
email = "admin@example.com"
password = "admin"
user = db.query(User).filter(User.email == email).first()
if not user:
print(f"User {email} not found!")
return
print(f"User found: {user.email}")
print(f"Stored Hash: {user.password_hash}")
# Test verification
is_valid = verify_password(password, user.password_hash)
print(f"Password '{password}' valid? {is_valid}")
if not is_valid:
print("Attempting to reset password...")
user.password_hash = get_password_hash(password)
db.commit()
print("Password reset. Testing again...")
is_valid = verify_password(password, user.password_hash)
print(f"Password '{password}' valid? {is_valid}")
db.close()
if __name__ == "__main__":
test_login()