Change user's email without verification

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?

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")
exit
exit

That’s console access, obviously.

2 Likes

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

1 Like

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.

4 Likes

No problem I made it a wiki.

2 Likes

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.

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: "oid@example.com").update(email: "new@example.com")
4 Likes

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?

3 Likes