Migrated password hashes support

Thanks @pfaffman

I’ve done some testing and can confirm that it doesn’t work with Drupal 7, which apparantly uses SHA-512 according to Drupal 7: Secure password storage by default at last | Jon Cave

I’ll create a PR if I’m able to add a compatible one.

Rich

3 个赞

Hello :wave:

I migrated a whole lot of content from bbPress over to my discourse installation. I can see all posts and users and stuff. But my users can’t login using their “old” password data from my WP site. I installed the plugin, its listed in my plugin section of my admin area. I checked all the available check marks.

Still: nobody can login!
I also have no idea where to apply the given code from the plugin’s readme:

user = User.find_by(username: 'user')
user.custom_fields['import_pass'] = '5f4dcc3b5aa765d61d8327deb882cf99'
user.save

Also I have no idea what exactly is meant by alternative password hashes talked about in the readme.

@michaeld could you provide some more guidance on how to use the plugin?

As far as I recall the bbpress importer supports the plugin, so you did everything right and that is all you would need to do.

1 个赞

Oh my god, after some more testing it turned out that it actually worked. The problem was a changed password when I tested it :man_facepalming: Sorry! Thanks for the great plugin! Made my life a lot easier!

2 个赞

Hi, I’m having problems making this work. I’ve created a custom field import_pass and installed the plugin. Ran the import script once again on my SMF database but with no luck, no one can login afterwards. On the custom field I can see just a “-“ instead of some hash.

Like other users pointed out before, not sure what do with this:

user = User.find_by(username: 'user')
user.custom_fields['import_pass'] = '5f4dcc3b5aa765d61d8327deb882cf99'
user.save

Appreciate any guidance Does this code go in the smf2.rb import script file or what?

That won’t work. But there is no need to install the plugin during import, or to create a custom field manually. It should be handled by the SMF2 script already. So something else is up.

The code is there as an example for script authors. It’s already in the SMF2 script.

3 个赞

Thanks. That’s great. So you mean, if I remove the manually created custom field and just keep the plugin activated, then it should work by itself and pick up the password hashes when it needs too.

Is there a log we can check to see why the plugin isn’t doing what is supposed to?

The plugin takes care of interpreting and using the custom fields that have been set by the importer. If the custom fields are empty or not there, then it is not an issue with the plugin, but an issue with the importer.

2 个赞

插件应该在迁移之前还是之后安装?还是说这没有任何影响?

TL;DR:之后。

您应该在实际运行已迁移论坛的实例上安装该插件。

我们曾发现,如果将插件安装在实际运行迁移脚本的实例上,会导致问题,因此我们不建议在此处安装。

4 个赞

你好,

有人测试过 Auth0 的密码哈希吗?

我无法直接进行测试,因为他们的密码哈希导出功能是一项付费客户服务。我只是想确认一下,在我自己尝试之前,是否有人已经尝试过这种方式。

看起来他们的密码是使用 bcrypt 进行哈希处理的,盐轮数为 10。

谢谢。

2 个赞

你好,关于 Drupal 7 的支持,有没有什么变化?

糟糕,这是一个我错过的两年前的问题!

bcrypt 应该支持任意轮数,只要轮数以通常方式编码($2a$10$...

没有,这段代码三年多没有动过了。

1 个赞