discourse-import_scripts/goss-checkmd5pwhash.rb

29 lines
883 B
Ruby
Raw Normal View History

# Load the Discourse environment
require File.expand_path("../../../config/environment", __FILE__)
# require_relative '/var/www/discourse/config/environment'
def query_md5_password_custom_field(username)
user = User.find_by(username: username)
if user
md5_password = user.custom_fields['custom_password_md5']
if md5_password
puts "MD5 password custom field for user #{username}: #{md5_password}"
else
puts "No MD5 password custom field set for user: #{username}"
end
puts "password_hash #{user.password_hash}"
puts "password_algorithm #{user.password_algorithm}"
puts "salt #{user.salt}"
puts "active #{user.active}"
puts "approved #{user.approved}"
else
puts "User not found: #{username}"
end
end
# Replace 'username' with the actual username
username = 'davidpaulyoung'
query_md5_password_custom_field(username)