from app import create_app, db
from app.models.models import User
from werkzeug.security import generate_password_hash

app = create_app()

with app.app_context():
    email = "test@example.com"
    new_password = "test123"

    user = User.query.filter_by(email=email).first()
    if not user:
        print("User not found ❌")
    else:
        # Hash password in the way your model expects
        user.password = generate_password_hash(new_password, method='pbkdf2:sha256')
        db.session.commit()
        print(f"Password reset successfully for {email}. Login with: {new_password}")
