Reset user password by Admin

AI-generated summary

In a support thread titled ‘Reset user password by Admin,’ RahulSharma reports a user unable to reset their password due to personal email account issues, seeking an admin-level reset option. JagWaugh shares a meta.discourse.org guide for changing user emails. blake initially suggests the user resolve email issues to use standard password reset, but later provides detailed steps to reset a password via Rails console: SSH into the server, enter the Discourse app container, launch rails c, find the user by email, assign a new password, and save — with a warning to backup the database first blake. RahulSharma asks for server shell instructions, which blake supplies. codinghorror emphasizes that email delivery problems threaten site functionality. RahulSharma clarifies the issue lies with the user’s email provider (not the forum’s SparkPost setup), and confirms the issue is resolved, thanking contributors — especially blake — for the console method learned. The consensus leans toward fixing email access first, but admin password reset via console is a viable workaround.

Hello,

I have had an issue with a user and he is unable to reset his password due to some mail issues. I wanted to reset his password or email from admin section but I don’t find the option. Kindly let me know how to solve this issue.

One option is to ask him to create a new account, then I change the ownership of his topics to a different user but that’s a creepy method. We should have a better way to handle this right?

Regards,
Rahul

Here is how I do it.

Do you know what the email issues are? Is he not receiving the emails? are they going to spam? can he not click on the password reset link in his email?

The “best” way to reset the password is for him to use the forget password and receive an email.

He is having issue with his registered mail account and hence unable to reset. He is asking me to reset his password. That’s all. No offence, but I think the admin should have the ability to reset it to a temporary password that expires in a day.

There is no user interface for an admin to reset a password, but you can through the rails console/database access.

Can you tell how to do that from the server shell?

First of all I would be very careful, and also backup your db.

ssh into your server
cd /var/discourse
./launcher enter app
rails c
u = User.find_by_email('email@test.com')
u.password='zKRR6vTZKvJAB84V9jdgeydS'
u.save!
ctrl+d to exit

I still think the user should figure out their email issues first though, so that they can just do a normal password reset, or change their email address for them.

If you have email issues your site is doomed: nobody will be able to sign up, get notifications, etc.

I don’t have issues with forum mailing system. I am using SparkPost and it works great. The problem was with users mail provider which is none of my concern directly. He is receiving the activation mail but unable to login to the web client.

Well I have resolved the issue anyway. Thank you everyone and especially @blake I learned something new :slight_smile: