Commit 9735ce15 authored by Horatiu Eugen Vlad's avatar Horatiu Eugen Vlad

Avoid resource intensive login checks if password is not provided

Fixes #32598
parent b0642299
---
title: Avoid resource intensive login checks if password is not provided.
merge_request: 11537
author: Horatiu Eugen Vlad
......@@ -37,6 +37,9 @@ module Gitlab
end
def find_with_user_password(login, password)
# Avoid resource intensive login checks if password is not provided
return unless password.present?
Gitlab::Auth::UniqueIpsLimiter.limit_user! do
user = User.by_login(login)
......@@ -44,7 +47,7 @@ module Gitlab
# LDAP users are only authenticated via LDAP
if user.nil? || user.ldap_user?
# Second chance - try LDAP authentication
return nil unless Gitlab::LDAP::Config.enabled?
return unless Gitlab::LDAP::Config.enabled?
Gitlab::LDAP::Authentication.login(login, password)
else
......
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