Andro
(Andrew Bernard)
December 15, 2020, 11:59pm
1
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.
1 Like
It needs to be done via the rails console, there’s a walkthrough here:
If you have access to the site’s rails console, you can change email addresses without triggering a confirmation email.
Enter the docker container and then launch the rails console:
./launcher enter app
rails c
Then find the user from their current email address:
u = User.find_by_email('oldemail@example.com')
Then update the email address:
u.update(email: 'newemail@example.com')
EDIT:
After updating the user’s email address though the command line, go to the Admin / Users page for the …
3 Likes
pfaffman
(Jay Pfaffman)
December 16, 2020, 12:36am
3
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.
3 Likes
Andro
(Andrew Bernard)
December 16, 2020, 12:59am
4
@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.
1 Like
neounix
(Dark Matter)
December 16, 2020, 3:21am
5
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.
2 Likes