2024-06-17 09:45:51 +00:00
|
|
|
# Load the Discourse environment
|
2024-08-28 11:02:47 +00:00
|
|
|
require File.expand_path("../../../../config/environment", __FILE__)
|
2024-06-17 09:45:51 +00:00
|
|
|
|
|
|
|
# require_relative '/var/www/discourse/config/environment'
|
|
|
|
|
|
|
|
def set_md5_password_custom_field(username, md5_password)
|
|
|
|
user = User.find_by(username: username)
|
|
|
|
if user
|
2024-08-29 10:46:26 +00:00
|
|
|
user.custom_fields['md5_password'] = md5_password
|
2024-06-17 09:45:51 +00:00
|
|
|
user.save!
|
|
|
|
puts "MD5 password custom field set for user: #{username}"
|
|
|
|
else
|
|
|
|
puts "User not found: #{username}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# Replace 'username' and 'md5_password_hash' with actual values
|
|
|
|
username = 'davidpaulyoung'
|
|
|
|
md5_password_hash = '$GT$i5ZNZdfX$077FK6JU70HIr2pR1/uLP1'
|
|
|
|
# md5_password_hash = 'i5ZNZdfX$077FK6JU70HIr2pR1/uLP1'
|
|
|
|
|
|
|
|
set_md5_password_custom_field(username, md5_password_hash)
|
|
|
|
|