Instructions and code to use drupal 7 passwords
This is another fork of http://djangosnippets.org/snippets/2729/ that fixes the issue. Unlike those other versions i give you instructions so it works for you, this is modified a little. Instructions: If you want to import the passwords from drupal you need to prepend to each of them the word drupal so it looks like this: drupal$S$DQjyXl0F7gupCqleCuraCkQJTzC3qAourXB7LvpOHKx0YAfihiPC Then add this snippet to someapp/hashers/DrupalPasswordHasher.py And then in your settings add this: PASSWORD_HASHERS = ( 'django.contrib.auth.hashers.PBKDF2PasswordHasher', 'someapp.hashers.DrupalPasswordHasher', 'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher', 'django.contrib.auth.hashers.BCryptPasswordHasher', 'django.contrib.auth.hashers.SHA1PasswordHasher', 'django.contrib.auth.hashers.MD5PasswordHasher', 'django.contrib.auth.hashers.CryptPasswordHasher', ) So, what did i modify First i added the attribute algorithm to the class, django uses this word to identify wich hasher to use, so the passwords beggining with drupal should be verified with the hasher.algorithm == 'drupal' Ok so know django knows to use our class, but now our passwords won't validate because we changed them by adding the word drupal, so what do we do? we modify the verify method to remove the word drupal before verification :P Hope it helps
- django
- password
- drupal