Reset user password by Admin


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?



Here is how I do it.

1 Like

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.

1 Like

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.

1 Like

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('')
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:


I have migrated users from old forum database. Is there any way to send password reset e-mails in bulk? I’ve tried to use API but got You have performed this action too many times, try again later. after requesting to send about 3 reset emails… (other API actions work fine)

I’d be happy to use ruby console or API if you can please advise how to go around that rate limit. It is probably limit per IP address as I’ve investigated.


Seems like RateLimiter for ‘forgot_password’ is unfortunately hardcoded so I went ruby script way…

For mass reseting (sending out tokens for password reset to all users) you can do

cd /var/discourse
./launcher enter app

Then create new file mass-password-reset.rb using your favourite editor with following script:

User.all.each do |u|
  email_token = u.email_tokens.create(email:
  Jobs.enqueue(:critical_user_email, type: :forgot_password, user_id:, email_token: email_token.token)

And then run it with rails r mass-password-reset.rb


Awesome, thanks! I recently migrated data from my old forum and when tried to manually reset passwords for my users (not too many of them), ran into error message. Discourse logs didn’t show anything, tried to rebuild app and it didn’t help. Then tried your script and now via outsourced email sending service (and Sidekiq) I see that these mails are sending out. So, thanks again! :slight_smile:


Tried this but the data model has now changed (due to secondary email I think). Email addresses are now in User Email object I think.