doc/security/unlock_user.md
GitLab locks a user account after the user unsuccessfully attempts to sign in several times.
{{< details >}}
{{< /details >}}
If two-factor authentication (2FA) is enabled, accounts are locked after three failed sign-in attempts. Accounts are unlocked automatically after 30 minutes.
If 2FA is not enabled user accounts are locked after three failed sign-in attempts within 24 hours. Accounts remain locked until either:
{{< details >}}
{{< /details >}}
{{< history >}}
{{< /history >}}
By default, user accounts are locked after 10 failed sign-in attempts. Accounts are unlocked automatically after 10 minutes.
In GitLab 16.5 and later, administrators can use the Application settings API to modify the max_login_attempts or failed_login_attempts_unlock_period_in_minutes settings.
Administrators can unlock accounts immediately by using the following tasks:
Prerequisites
To unlock an account from the Admin area:
The user can now sign in.
Prerequisites
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.