# Load the Discourse environment require File.expand_path("../../../../config/environment", __FILE__) # require_relative '/var/www/discourse/config/environment' def set_user_password(username, new_password) user = User.find_by(username: username) if user # Use the `password=` method to properly hash the password user.password = new_password user.save! puts "Password updated for user: #{username}" else puts "User not found: #{username}" end end # Replace 'username' and 'new_password' with actual values username = 'davidpaulyoung' new_password = 'T3s7P4ssw0rd.' set_user_password(username, new_password)