How to change user email if email account has been deleted

AI-generated summary

If a user’s email account has been deleted, they won’t be able to change their email address through the site preferences due to the confirmation email being sent to the inaccessible address. awesomerobot suggests resolving this issue via the Rails console, referencing a walkthrough here. Alternatively, as pfaffman proposes, another admin can temporarily remove the user’s admin rights, allowing them to change their email address. Andro successfully used the Rails console method and provided clarification on the necessary commands. neounix offers an additional approach, using the command docker exec -it app rails c to access the Rails console in one line, and suggests setting up an alias for this command for ease of use.

I deleted my email account with a certain mail service. Now when changing email in preferences, it says to check the confirmation email sent to that address, now inaccessible. Even as the site administrator when changing the email I get the same message.

What to do in this case? This must be a common enough occurrence.

It needs to be done via the rails console, there’s a walkthrough here:

The other way to do this, if you hate Rails and there are multiple admins, is have the other admin take away your admin rights, then you change your address, then they give you admin back.

@awesomerobot thanks so much. Works well.

Just one edit, you need two separate commands:

# ./launcher enter app
# rails c

These were conflated in the post. Confused me for a while.

Or you can do this in one line, as follows:

docker exec -it app rails c

This is how I generally run the rails console when I have a quick query to do or to check some object, etc.

To make things easier, I have the following alias set up on my system (except the name of app is different for us):

alias railsc='docker exec -it app rails c'

In this manner, we can easily enter the rails console by typing railsc on the command line outside the container.

ubuntu:/home/neo# railsc
[1] pry(main)> User.count
=> 139160
[2] pry(main)> Topic.count
=> 380629
[3] pry(main)> Post.count
=> 1034861
[4] pry(main)> SiteSetting.count
=> 157
[5] pry(main)> SiteSetting.force_https
=> true

Don’t forget to change the name to match your container in your alias setup.

HTH.