# Handling user passwords when importing from another forum software?

**URL:** https://meta.discourse.org/t/handling-user-passwords-when-importing-from-another-forum-software/29324
**Category:** Support
**Created:** [May 27, 2015, 7:37pm UTC](https://meta.discourse.org/t/handling-user-passwords-when-importing-from-another-forum-software/29324 "2015-05-27T19:37:55Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![jeffwidman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jeffwidman/32/105515_2.png) [@jeffwidman](https://meta.discourse.org/u/jeffwidman)
#### Post date: [May 27, 2015, 7:37pm UTC](https://meta.discourse.org/t/handling-user-passwords-when-importing-from-another-forum-software/29324/1 "2015-05-27T19:37:55Z")

</div>

Continuing the discussion from [phpbb3 import script - users cannot login - password error](https://meta.discourse.org/t/phpbb3-import-script-users-cannot-login-password-error/29320/2):

> [@Phpbb3 import script - users cannot login - password error](https://meta.discourse.org/t/phpbb3-import-script-users-cannot-login-password-error/29320/2):
>
> For security reason, we can’t import passwords. All your users will have to reset their password.

Curious on this.

How hard is it to add a function that checks the password using the hashing scheme of the old forum and then re-encrypts using the new Discourse scheme?

For example, for a user-entered password, first try bcrypt (assuming Discourse uses this), then if that fails try MD5 (assuming phpbb uses that), and if that fails return an error. If MD5 returns successful, then re-encrypt the password using bcrypt and overwrite the old md5 hash.

Could this be implemented at the Postgres level without even needing to add anything to the Rails app?

I know Xenforo handles this in their imports automatically and it’s a very handy thing to have for an older forum where many users aren’t using valid email addresses. I’ve been amazed how many times people give up in frustration when their old password isn’t working and just create a new account. Makes me think there’s a good number who just give up and never re-register.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [May 27, 2015, 7:47pm UTC](https://meta.discourse.org/t/handling-user-passwords-when-importing-from-another-forum-software/29324/2 "2015-05-27T19:47:08Z")

</div>

I think the importers that @michaeld wrote have this feature. We do not do it in ours.

---

<div class="post-metadata">

### Author: ![michaeld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaeld/32/1594_2.png) [@michaeld](https://meta.discourse.org/u/michaeld)
#### Post date: [May 27, 2015, 8:58pm UTC](https://meta.discourse.org/t/handling-user-passwords-when-importing-from-another-forum-software/29324/3 "2015-05-27T20:58:31Z")

</div>

We have a plugin that does exactly what @jeffwidman suggests.

It’s not that hard to add in an importer.

You only need to do two things to accomplish this:

- Make sure the importer stores the password hash in a custom user field called `import_pass`,
- Install [GitHub - communiteq/discourse-migratepassword: Support migrated password hashes · GitHub](https://github.com/communiteq/discourse-migratepassword) plugin

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [October 25, 2016, 9:21pm UTC](https://meta.discourse.org/t/handling-user-passwords-when-importing-from-another-forum-software/29324/4 "2016-10-25T21:21:17Z")

</div>

I just wrote an importer for [mylittleforum](http://www.mylittleforum.net/) (not yet, but soon to be, submitted as a PR) and included an `import_pass` field as recommended here. I’d totally forgotten about it when my client (who’s using [https://www.communiteq.com/](https://www.communiteq.com/)) claimed that his old passwords worked! I thought he was crazy at first. 🙂

Thanks, @michaeld!

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [March 22, 2019, 2:46am UTC](https://meta.discourse.org/t/handling-user-passwords-when-importing-from-another-forum-software/29324/5 "2019-03-22T02:46:49Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [May 15, 2022, 5:00am UTC](https://meta.discourse.org/t/handling-user-passwords-when-importing-from-another-forum-software/29324/6 "2022-05-15T05:00:19Z")

</div>



---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [May 15, 2022, 9:53am UTC](https://meta.discourse.org/t/handling-user-passwords-when-importing-from-another-forum-software/29324/7 "2022-05-15T09:53:58Z")

</div>


