Commit 79631c66 authored by Ben Prescott @bprescott_↙ ☺'s avatar Ben Prescott @bprescott_↙ ☺ Committed by Achilleas Pipinellis

Password reset improvements

parent d9e94018
...@@ -11,6 +11,8 @@ There are a few ways to reset the password of a user. ...@@ -11,6 +11,8 @@ There are a few ways to reset the password of a user.
## Rake Task ## 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, GitLab provides a Rake Task to reset passwords of users using their usernames,
which can be invoked by the following command: 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 ...@@ -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 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. using user ID and then change password of the user manually.
1. Start a Rails console 1. [Start a Rails console](../administration/operations/rails_console.md)
```shell
sudo gitlab-rails console -e production
```
1. Find the user either by user ID or email ID: 1. Find the user either by username, user ID or email ID:
```ruby ```ruby
user = User.find_by_username 'exampleuser'
#or
user = User.find(123) user = User.find(123)
#or #or
...@@ -81,6 +83,23 @@ using user ID and then change password of the user manually. ...@@ -81,6 +83,23 @@ using user ID and then change password of the user manually.
NOTE: NOTE:
You can also reset passwords by using the [Users API](../api/users.md#user-modification). 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 ## Reset your root password
The previously described steps can also be used to reset the 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