Drupal password migrate into Discourse with discourse-migrate-password plugin

  1. Install and Enable the Plugin:
    • Begin by installing the Discourse Migrate Password plugin from the following

Discourse Migrate Password Plugin
link:
(https://github.com/communiteq/discourse-migratepassword/blob/master/plugin.rb).

  • Once installed, enable the plugin within your Discourse settings. This enables the migration of insecure passwords into Discourse.

  1. Create a Custom Field:
    • Within Discourse, navigate to the user customization settings.
    • Here, create a custom field named “import_pass.”

  1. Import Users:

    • Proceed to import one or multiple users into Discourse using your preferred method.
    • During the import process, make sure to include a hash string in the “import_pass” field for each user.
  2. Login Attempt:

    • Attempt to log in to Discourse using a combination of the imported username and the hash string.
    • However, you might encounter an error message stating “Incorrect username and password.”

  1. Standard Login:
    • As an alternative, you can successfully log in to Discourse by using the username and password associated with the account.

Please share me solution to use this plugin in discourse for Drupal password migrate into discourse
@Discourse

1 Like

In order to have Drupal support for imported users, it’s necessary to amend the existing Drupal importers so they will fill the import_pass field. The base importer has support for this so all you need to do is feed the applicable database field into the structure you feed to create_users with the key password. For example, the VBulletin importer does that here.

For the Drupal importers, that’s here and here.

Step 2 is something that is not and never will be required or necessary. Where did you get that from?

You should enable the plugin AFTER the import and leave it disabled during the import.

So the correct steps are:

  • import users
  • install and enable the plugin
2 Likes

In the context of our discussion, I appreciate your valuable feedback regarding the previous query. However, I am interested in exploring the topic of how to test the functionality of my plugin to determine whether it is functioning correctly. I have followed the installation steps as outlined, but I am encountering issues as it does not seem to be responsive. I am uncertain about how to verify whether it is triggering the script appropriately. Specifically, I would like to understand the process by which it checks if the user’s initial password choice is not empty or incorrect before proceeding to execute the plugin script.

I would greatly appreciate it if you could provide me with further insights on this matter. Thank you in advance for your assistance.

The plugin works by overriding the confirm_password? method of the User class.
It first calls the original password check and doesn’t do anything when the password is accepted by the core Discourse logic.

If that’s not the case, it checks whether the user has a import_pass custom field and if so, it uses all available algorithms to check the entered password against the import_pass hash.

If it finds a match, it saves the entered password as the password for the user and allows the user to log in.

3 Likes

I’ve created a PR adding support for Drupal 6 hashes migrated to Drupal 7.

This might be a reason why the credentials were considered invalid as described in this topic.

1 Like