goss-resetpw.rb v0.1 -- for Lance, etc to reset passwords

This commit is contained in:
David Sainty 2024-10-09 03:29:35 +11:00
parent 4ade531ca7
commit 98814a1957

View File

@ -16,15 +16,15 @@ class GossamerResetPassword
# Delete Gossamer MD5 Password # Delete Gossamer MD5 Password
user.custom_fields.delete('md5_password') # This removes the field completely user.custom_fields.delete('md5_password') # This removes the field completely
user.save! user.save!
puts " STEP 1 COMPLETED: Gossamer MD5 Password custom field removed for username: #{username}" puts " STEP 1 COMPLETED: Gossamer MD5 Password custom field removed for username: #{discourse_username}"
# Set the Discourse password with the `password=` method to properly hash the password # Set the Discourse password with the `password=` method to properly hash the password
user.password = new_password user.password = new_password
user.save! user.save!
puts " STEP 2 COMPLETED: Discourse Password updated for user: #{username}" puts " STEP 2 COMPLETED: Discourse Password updated for username: #{discourse_username}"
else else
puts "User not found: #{username}" puts "User not found: #{discourse_username}"
end end
end end
end end