A small module that enables the use of WordPress-hashed passwords in Drupal 7. The module checks if a user's password validates successfully against WordPress's hashing technique whilst a user is attempting to log in, and rehashes the password using Drupal's built-in hashing technique - effectively converting the user's password from a WordPress hash to a Drupal hash without any manual intervention.
This module was created as a result of needing to seamlessly import 4500+ users from an existing WordPress site into rebuild of the same site using Drupal without any action on the user's behalf.

The module contains the file class.phpass.php from WordPress 3.8.0, which is licensed under GPL v2. See https://wordpress.org/about/gpl/ for more information.

Clone at git://git.drupal.org/sandbox/selexin/2384473.git

Comments

PA robot’s picture

Status: Active » Needs work

There are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxselexin2384473git

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

joachim’s picture

> core = 7.x`

Stray backtick.

> * Implementation of hook_form_alter()

It's more efficient here to use hook_form_FORM_ID_alter(). Though.... I seem to remember the user login page and block have different form IDs?

/*
 * Implementation of hook_form_alter()
 */

Docblock formatting is incorrect -- missing *

Same here, and lines need wrapping:

/*
 * Validation handler for user login form.
 *   Converts password from wordpress hash (if found) to Drupal hash during the validation process, so that the password is already
 *   stored as a Drupal hash during the submit process (allowing uninterupted first-time login by the user)
 */

Further coding standards issues -- the automated review should have picked them up.

Other than that, looks ok, though I don't know enough to comment on this:

			if(substr($loaded_user->pass, 0, 3) == '$P$') { //not the best way to consider a password is from WordPress. I'm welcome to other suggestions.
selexin’s picture

Status: Needs work » Needs review

Issues addressed and fixed.

Removed class-phpass.php and instead added download and install instructions in hook_enable and README.txt

nesta_’s picture

It would be nice if could not translate the link as it is now.
You could encapsulate the text if it must be translated with the t() function which then do not drupal_set_message ($error), 'warning');

Maybe?

function wordpress_passwords_enable() {
  if (!file_exists(WORDPRESS_PASSWORDS_WP_CLASS)) {
    $error = t("Could not find class-phpass.php. Please read for installation instructions:");
    $error .= "<a href='" . drupal_get_path('module', 'wordpress_passwords'); . "/README.txt>README.txt</a>";
    drupal_set_message(($error), 'warning');
  }
}
nesta_’s picture

simplytest.me/project/2384473

I have not found error message about not having the class-phpass.php in includes directory.

joachim’s picture

Status: Needs review » Needs work
    $error .= "<a href='" . drupal_get_path('module', 'wordpress_passwords'); . "/README.txt>README.txt</a>";
    drupal_set_message(($error), 'warning');

This won't be translatable.

joachim’s picture

> * Install file for wordpress_passwords.

This file is in the wrong place, and core probably won't find it. It should be in the same folder as the .info and the module file.

> Install Instructions: Download class-phpass.php from
https://raw.githubusercontent.com/WordPress/WordPress/3.8-branch/wp-incl...
to the folder 'includes' inside this module directory

That's not a recommended way to do things -- when users upgrade your module, they'll clobber that file and have to download it all over again. Use Libraries module to declare the WP file as a required PHP library, and hook_requirements() to only allow your module to be enabled when it's present (rather than hook_enable()).

Chetan Sharma’s picture

FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
4 | WARNING | Line exceeds 80 characters; contains 93 characters

Make the character count less that 80 for remove error from http://pareview.sh/pareview/httpgitdrupalorgsandboxselexin2384473git

Hit enter after some character is the solution.

PA robot’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).

I'm a robot and this is an automated message from Project Applications Scraper.