Change user's email without verification

(Carlo Kok) #1

Maybe I’m missing something obvious, but I cannot find it. As an admin, can I change someone’s email address without them having to verify it?

(Eli the Bearded) #2

Off-hand, I’d guess something like this would work:

cd /var/discourse
./launcher enter app
rails c
User.find_by(email: "chowder@mmmm.fooo").update(email: "bisque@soup.mmmm")

That’s console access, obviously.

(Jeff Atwood) #3

I vaguely recall another topic here about this exact situation; try some searches.

(Andrew Waugh) #4

Try this, the verification mail goes out, but they don’t have to respond to it:

Too late for me to edit that now, but it should be deactivate, change, reactivate iirc.

(Jeff Atwood) #5

No problem I made it a wiki.


I am a new discourse user and I ran into the same issue. When I try the same approach (deactivate the user, update the email address, and then activate the user) it sending an email to confirm and it is only updating the email address after clicking the confirm email link. Is there a way to avoid this? I am using the API to do all the three actions.

(Stephen Chung) #7

There has been a change in the way emails are stored in the database.

The following commands should work:

cd /var/discourse
sudo ./launcher enter app
rails c

UserEmail.find_by(email: "").update(email: "")

Changing users email address
Change user email without email verification
Can't change (multiple) users' emails any more

This will work fine but I am trying to do this via API as I will have to update multiple email addresses on a daily basis. Is it possible to do this via API?