Backup restore after migration, no admin account creation email

Hi there, I’ve now done 2 test installations with the backup from my Drupal migration, which I restored on fresh Discourse instances in a different VPS with correctly configured FQDN and working email. The importer instance was just using the IP address of the VPS, and it didn’t have email configured. I’m not sure if that has anything to do with this issue, but in both my backup restore tests after the restore is complete and it brings me to the admin account creation page, I can’t activate the account because it doesn’t send the email. I was able to work around this with:   ./launcher enter app  ,   rake admin:create  . After that I can login to the web app and successfully run email tests, and if I enable emails for all users then the other user accounts can successfully receive the forgotten password reset email. So this appears to be a bug with the default setting after restore of no emails to non-staff. I guess it should consider the email addresses defined as admin users to be staff even before their accounts are validated.

That suggests that the import script didn’t create an admin account. If you just log in and/or create an account using the developer_email address, you’ll be OK.

That’s likely because restoring the backup turned off email for non-staff and that user isn’t staff.

Maybe? It’s certainly a chicken-egg issue with a new site and a migration. I think if you add your user to developer_emails then it’ll work.

The other thing you can do is add something like this to your script:

   User.create(username: 'pat-the-admin', email: '',password: 'very-safe-123', active: true, name: "Pat User")     unless User.find_by_email('`)

Thanks for the reply Jay. Yeah, that’s what appears happened. And yet somehow after using the console to activate my temporary new admin account and checking the users list I saw that my previous Drupal username that had Drupal admin permissions automatically received Discourse admin status.

In my app.yml I have:

Yeah. I suspect that a user isn’t staff until the account is activated. What I usually do is use a Google auth on my import sites and make sure that the people I want to be able to log in are in DEVELOPER_EMAILS and have a gmail address.

1 Like