Is there a rake command to reset a Redmine admin password?

vfclists picture vfclists · Jun 5, 2015 · Viewed 8k times · Source

I have lost the admin password for a redmine installation, and after trying the method of clearing the salt and setting the default hash for the password password I still cannot login.

Is there a rake command to set the default password, or set a specific password?

The Redmine version is 2.4.2

Answer

gotva picture gotva · Jun 5, 2015

I believe you can reset your (any) password from rails console. Go to the Redmine folder on server and

# start console
RAILS_ENV=production bundle exec rails c

# find your user
user = User.where(email: '[email protected]').first

# set new password
user.password = '123123'
user.password_confirmation = '123123'

# save changes
user.save!

Please note if save! returns exception then changes can not be applied. Post exception message to the question.