Extras -- checkmd5pwhash, setmd5pwhash, setdispw, delalluser

This commit is contained in:
dsainty
2024-06-17 19:45:51 +10:00
parent 22526c4044
commit 9903c42a5e
4 changed files with 93 additions and 0 deletions

28
goss-checkmd5pwhash.rb Normal file
View File

@@ -0,0 +1,28 @@
# 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)