How to unlock a locked user from the command line

原文:https://docs.gitlab.com/ee/security/unlock_user.html

How to unlock a locked user from the command line

十次失败的登录尝试后,用户将进入锁定状态.

要解锁锁定的用户:

  1. SSH 到您的 GitLab 服务器.
  2. 启动 Ruby on Rails 控制台:

    1. ## For Omnibus GitLab
    2. sudo gitlab-rails console -e production
    3. ## For installations from source
    4. sudo -u git -H bundle exec rails console -e production
  3. 查找要解锁的用户. 您可以通过电子邮件或 ID 进行搜索.

    1. user = User.find_by(email: 'admin@local.host')

    or

    1. user = User.where(id: 1).first
  4. 解锁用户:

    1. user.unlock_access!
  5. 使用Ctrl + d退出控制台

用户现在应该可以登录了.