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

app = create_app()

with app.app_context():
    # Get the admin user
    admin = User.query.filter_by(username='admin').first()
    
    if admin:
        # Set a new password
        new_password = 'admin123456'
        admin.password_hash = generate_password_hash(new_password)
        
        # Save changes
        db.session.commit()
        
        print(f"Password for user '{admin.username}' has been reset to '{new_password}'")
    else:
        print("Admin user not found")