Skip to content
Snippets Groups Projects
Commit 79631c66 authored by Ben Prescott's avatar Ben Prescott Committed by Achilleas Pipinellis
Browse files

Password reset improvements

parent d9e94018
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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:
 
Loading
Loading
@@ -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
Loading
Loading
@@ -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.
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment