Unblock LDAP or Active Directory user in GitLab

If you're running a self-hosted GitLab instance and use LDAP or Active Directory authentication you may notice that sometimes users get "Blocked" and you can't unblock them using the web interface.

When this situation occurs, you can unblock them using the gitlab-rails console directly in the server.

Run the following:

$ gitlab-rails console production

And then inside the console you can find the user by email and set it to "Active" like this:

> user = User.find_by_email("[USER-EMAIL]")
> user.state = "active"
> user.save
> exit

Replace [USER-EMAIL] with the actual email you're looking for. The user should now be active and ready to login.