将Parse.com密码迁移到Django [英] Migrating Parse.com passwords to Django
问题描述
我正在尝试将数据从Parse.com迁移到我们自己的服务器.为此,用户密码也必须迁移. Parse.com使用标准的bcrypt密码加密,并且密码以以下格式显示():
I am trying to migrate the data from Parse.com to our own servers. In order to do this, user passwords have to be migrated too. Parse.com uses standard bcrypt password encryption and passwords appear in the following format (How would I move passwords out of Parse to another server?):
$2a$10$UpoNYQ0YE/FRVrh3xt6QQeQ3HmTmskbW2Sfg5DX9fDQJnIHQd1LqG
我如何将该字符串移动到Django auth_user表中,以便Django可以接受它
How do I move this string to Django auth_user table so it will be accepted by Django
我已经尝试根据下面的 shtuff.it 建议将BCrypt密码哈希添加到设置中:
I've tried adding BCrypt password hashers to settings according to shtuff.it suggestion below:
PASSWORD_HASHERS = (
'django.contrib.auth.hashers.BCryptSHA256PasswordHasher',
'django.contrib.auth.hashers.BCryptPasswordHasher',
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
'django.contrib.auth.hashers.SHA1PasswordHasher',
'django.contrib.auth.hashers.MD5PasswordHasher',
'django.contrib.auth.hashers.CryptPasswordHasher',
)
并尝试将 bcrypt 添加到字符串的开头:bcrypt$2a$10$UpoNYQ0YE/FRVrh3xt6QQeQ3HmTmskbW2Sfg5DX9fDQJnIHQd1LqG
这给了我来自bcrypt哈希器的无效盐"消息.我还尝试过使用该字符串并将其设置为bcrypt$<iterations>$<salt>$hash
形式或其他组合形式,但是无法消除"invalid salt"消息.
And tried adding bcrypt to the beginning of the string: bcrypt$2a$10$UpoNYQ0YE/FRVrh3xt6QQeQ3HmTmskbW2Sfg5DX9fDQJnIHQd1LqG
This gives me "invalid salt" message from bcrypt hasher. I also tried playing with the string and bringing it to the form bcrypt$<iterations>$<salt>$hash
form or some other combinations, but could not make the "invalid salt" message go away.
推荐答案
看起来您应该能够在settings.py中将bcrypt添加到PASSWORD_HASHERS中:
Looks like you should be able to add bcrypt to PASSWORD_HASHERS in settings.py:
https://docs.djangoproject .com/en/dev/topics/auth/passwords/#using-bcrypt-with-django
这篇关于将Parse.com密码迁移到Django的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!