Unable to change email address after switching domains

(John Lynch) #1

I’ve just started hosting a very small, private Discourse community. I’m a newbie; please be gentle.

When I originally set the community up, I set it up at foo.com. My members and I hadn’t determined what permanent domain we’d like, so I set one up temporarily. After we’d made that determination to switch to bar.com, I followed the instructions here to change the domain. It worked almost perfectly.

There was one slight hitch: originally, my admin account was set in Discourse to use the email address admin@foo.com. The hostname for the Discourse install was simply foo.com; I did not use a subdomain. When I changed domains, I decided to use www.bar.com as the hostname; in other words, the original hostname did not include the www subdomain, but the new one did. The problem is two-fold: first, the instructions above for switching domains caused the admin email account to be changed to admin@www.bar.com (I assume it was the remap/rebake step that did this; willing to be wrong about this); second, when I try to correct the email address (to admin@bar.com), Discourse keeps trying to email admin@www.bar.com (according to my sparkpost message logs), which doesn’t exist. I assume it’s supposed to email the new email address so that I can confirm it exists. The result is that I have no way to get a correct email address for my admin account: the domain switch step changed it to something invalid, and the change email process keeps emailing an invalid address.

I’m new enough at this that I’m not sure if I’m reading the situation correctly. I’m happy to answer any questions. Thanks for you assistance and patience.

(Jay Pfaffman) #2

Discourse will send mail with it’s domain name. You need to configure spark post to deliver for that domain. That’s the best and easiest solution.

You can also edit app.yml and uncomment a line best the bottom to set the sending address to the old domain.

If you’ve lost access to your Discourse admin account, you can enter the container and

rake admin: create

You can do a search for more complete instructions.

(Michael - DiscourseHosting.com) #3

@pfaffman I don’t think this is about the sending address, but about the admins receiving address.

Yes, always include // if you are remapping domains, so //foo.com to //www.bar.com
Just remapping foo.com to www.bar.com does nasty things.

You can always remap the emails to correct them: remap @www.bar.com to @foo.com

(John Lynch) #4

That’s correct. Email is sending to everyone else just fine. Performing another remap seems like a viable option. But why would Discourse be trying to email the address that I’m trying to switch from and not the one I’m trying to switch to? That’s the part I really don’t understand.

(Michael - DiscourseHosting.com) #5

It wants to confirm both.

we need you to confirm that you control the current email account. After you complete this step, we will have you confirm the new email address.

I guess it’s a security measure, but in our experience it causes more trouble than it does good.

(John Lynch) #6

Huh. I guess I missed that. My apologies. This does seem really problematic; I would have thought that access to my Discourse account was proof enough that I should be allowed to change the email address. I don’t think I’ve ever had a system email my old address before as a necessary confirmation step (but then I don’t change email addresses often, so what do I know). This is intended behavior then, not a bug. I’ll try the suggested remap and see if that works. Thanks!

(Joshua Rosenfeld) #7

It is a security measure - and it only applies to Admin accounts. Among other things, email serves as a form of two-factor auth for admin tasks, like downloading backups. If your admin account was compromised and the email could be changed without your knowledge - they could simply change the email to get the backup. This feature prevents that.

(Michael - DiscourseHosting.com) #8

Makes perfect sense, thanks for explaining!

(John Lynch) #9

I tried this just now and it appears to have worked. Thank you everyone for your patient assistance.

As a side question: is there a standard solution for if an admin needs to change their email address from an email address they no longer have access to? Or are you just out of luck at that point?

(Joshua Rosenfeld) #10

Your best bet is to work with another admin. Demote the account you need to change the email on. Change the email (no current email confirmation as you’re no longer admin). Promote the account back to admin.