doc/security/unlock_user.md
{{< details >}}
{{< /details >}}
{{< history >}}
{{< /history >}}
GitLab locks a user account after several failed authentication attempts. To unlock an account, wait for the end of the automatic unlock period or reset your password.
The following situations can cause a failed authentication attempt:
Lock and unlock behavior depends on the offering and the user's 2FA status:
On GitLab Self-Managed and GitLab Dedicated, use the application settings API
to configure the max_login_attempts and failed_login_attempts_unlock_period_in_minutes lockout limits.
{{< details >}}
{{< /details >}}
Prerequisites
On GitLab Self-Managed and GitLab Dedicated instances, administrators can manually unlock an account before the end of the unlock period.
{{< tabs >}}
{{< tab title="Admin area" >}}
To unlock an account from the Admin area:
The user can now sign in.
{{< /tab >}}
{{< tab title="Rails console" >}}
To unlock a user account from a Rails console:
Start a Rails console session.
Find the user to unlock:
By username:
user = User.find_by_username('exampleuser')
By user ID:
user = User.find(123)
By email address:
user = User.find_by(email: '[email protected]')
Unlock the user:
user.unlock_access!
Exit the console:
exit
The user can now sign in.
{{< /tab >}}
{{< /tabs >}}