Commit a64962d8 authored by Achilleas Pipinellis's avatar Achilleas Pipinellis

Merge branch 'docs-bprescott/20210318-resetpassword' into 'master'

Password reset improvements

See merge request gitlab-org/gitlab!56992
parents 4f7a043f 79631c66
......@@ -11,6 +11,8 @@ There are a few ways to reset the password of a user.
## Rake Task
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/52347) in GitLab 13.9.
GitLab provides a Rake Task to reset passwords of users using their usernames,
which can be invoked by the following command:
......@@ -38,15 +40,15 @@ The Rake task is capable of finding users via their usernames. However, if only
user ID or email ID of the user is known, Rails console can be used to find user
using user ID and then change password of the user manually.
1. Start a Rails console
```shell
sudo gitlab-rails console -e production
```
1. [Start a Rails console](../administration/operations/rails_console.md)
1. Find the user either by user ID or email ID:
1. Find the user either by username, user ID or email ID:
```ruby
user = User.find_by_username 'exampleuser'
#or
user = User.find(123)
#or
......@@ -81,6 +83,23 @@ using user ID and then change password of the user manually.
NOTE:
You can also reset passwords by using the [Users API](../api/users.md#user-modification).
## Password reset does not appear to work
If you can't sign on with the new password, it might be because of the [reconfirmation feature](../user/upgrade_email_bypass.md).
Try fixing this on the rails console. For example, if your new `root` password isn't working:
1. [Start a Rails console](../administration/operations/rails_console.md).
1. Find the user and skip reconfirmation. Any of the methods to find the user, above, will work:
```ruby
user = User.find(1)
user.skip_reconfirmation!
```
1. Try to sign in again.
## Reset your root password
The previously described steps can also be used to reset the root password.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment