I can't change my admin user email

So guys, I have a forum, and on that forum I am the only admin and owner! It turns out that when I made this site I used an email called REDACTED this email I used through the cpanel of TMD hosting, it happened that I no longer use the services of tmd hosting and went to the digital ocean and I even forgot that my adm’s email was this, I didn’t change it! It turns out that now I went to give the administration to another account of mine on the forum and the forum asks me to enter my account REDACTED and confirm that I want to give the admin to another account, but I can no longer access the cpanel of tmd hosting to access REDACTED, what do I do?

[image]

3 Likes

I contacted TMD hosting and was informed that my email REDACTED no longer exists, and only by purchasing a new server I can activate it, but what about my forum admin? will you be stuck forever in this email REDACTED ? there’s no way I can change it even though I have the password for all the things on my own forum?

2 Likes

You can change your admin email through the rails console with this handy guide: :+1:

4 Likes

thanks for answering me, but now another problem has arisen that even following some tutorials I can’t find! How do I see the user ID?

[image]

2 Likes

There’s a way to do it in that guide using your username instead, which might be easier?

2 Likes
root@ForumPandex:/var/discourse# u = User.find_by_username("dex")
-bash: syntax error near unexpected token `('
root@ForumPandex:/var/discourse#

i use that comand, but appear it, how fix?

1 Like

You need to follow the guide more closely. You’re missing the steps where you Enter the container, and then Access Rails Console before running the next commands.

However, I would also suggest taking a backup of your site before diving any deeper. The step by step in the guide certainly makes it easier, but if you’re unfamiliar with the rails console accidents can happen. You don’t want to mess anything up without having a recent backup handy. :+1: :crossed_fingers:

1 Like

what is bits? i dont know

2 Likes

I’ve given the language in my post above a tweak. Hopefully that’s clearer now. :+1:

If this is still not making sense, I would take a step back and maybe think about getting some help in the marketplace.

I’m using Google Translate, I can’t understand what you said, maybe it’s some wrong translation or out of google context!

But what I don’t understand is that I’m following the step by step correctly, I don’t know why this appears:

-bash: syntax error near unexpected token `(’

What is market place?

1 Like

I restarted my computer, and the error stopped! But now another error came, in the step of putting the email, u.email = "REDACTED" it looks like this

invalid mark letter (press return)

1 Like

in the step of putting the email, u.email = "REDACTED" it looks like this

invalid mark letter (press return)

how i fix it?

2 Likes

I don’t understand what is wrong from your description. Make sure that there is no trailing space after the email address. But I recommend creating a new admin user with

   rake admin:create

Then remove admin and moderator privileges from the user whose address you want to update. Then you can make that user an admin again.

3 Likes

I put this before which step? Anyway, now it’s showing up

root@ForumPandex:~# cd /var/discourse
root@ForumPandex:/var/discourse# ./launcher enter app
x86_64 arch detected.
WARNING: containers/app.yml file is world-readable. You can secure this file by running: chmod o-rwx containers/app.yml
root@ForumPandex-app:/var/www/discourse#

1 Like
root@ForumPandex:~# cd /var/discourse
root@ForumPandex:/var/discourse# ./launcher enter app
x86_64 arch detected.
WARNING: containers/app.yml file is world-readable. You can secure this file by running: chmod o-rwx containers/app.yml
root@ForumPandex-app:/var/www/discourse# rails c
[1] pry(main)> u = User.find_by_username "=dex="
=> nil
[2] pry(main)> e.email = "EMAIL"
NameError: undefined local variable or method `e' for main:Object
from (pry):2:in `__pry__'
[3] pry(main)> u.email = "EMAIL"
NoMethodError: undefined method `email=' for nil:NilClass
from (pry):3:in `__pry__'
[4] pry(main)> u.email_tokens.create(email: u.email)
NoMethodError: undefined method `email_tokens' for nil:NilClass
from (pry):4:in `__pry__'
[5] pry(main)> u.save!
NoMethodError: undefined method `save!' for nil:NilClass
from (pry):5:in `__pry__'
[6] pry(main)>
1 Like

I’ve moved your posts over to here to keep all the information of the issue in one place so people can find it easier to help you. :+1:

Just to note as well, you should consider not revealing your admin email itself in your help requests. One of our community experts is helpfully editing it out of your posts as you go, but it would be easier if it was not included. :slightly_smiling_face:

It seems you’ve figured out how to get to the rails console. :+1: But it looks like you’ve included the placeholder = signs when inputting the username. You should enter the username without them.


Though @pfaffman has suggested an alternative method if this one is proving too tricky:

If you create a second admin it would allow you to remove the admin privileges from the account you want to change the email address of, and remove the security restriction of needing email confirmation from the old email address. You can then change the email of the original account using the new admin, before regranting admin privileges again.

You can find more info about the create admin rake task in Create an admin account from the console

1 Like

You didn’t enter the username into the blank fields in the topic that has the code in it so what is should be the username is instead the text that is the place holder.

u = User.find_by_username "=dex="

Should be.

 u = User.find_by_username "dex"

If dex is the username. The fact that it returns nil rather than the user record is your indication that you don’t have a user record. Since you don’t understand those basics I really recommend creating a new user as suggested earlier. That will allow you to work with more familiar tools.

2 Likes

otherwise it just gave me problems, so I did this one to create a new adm and it worked, with the new adm I deleted the old one, thanks for everything!

[image]

3 Likes

thanks for the help, i’m very grateful for you! a kiss from Brazil

[image]

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.