mirror of
https://github.com/ansible/awx.git
synced 2026-03-05 18:51:06 -03:30
Merge pull request #6298 from jangsutsr/6237_prevent_ldap_user_from_imposing_existing_tower_user
Prevent LDAP user from imposing existing Tower user
This commit is contained in:
@@ -90,6 +90,12 @@ class LDAPBackend(BaseLDAPBackend):
|
|||||||
if not feature_enabled('ldap'):
|
if not feature_enabled('ldap'):
|
||||||
logger.error("Unable to authenticate, license does not support LDAP authentication")
|
logger.error("Unable to authenticate, license does not support LDAP authentication")
|
||||||
return None
|
return None
|
||||||
|
try:
|
||||||
|
user = User.objects.get(username=username)
|
||||||
|
if user and (not user.profile or not user.profile.ldap_dn):
|
||||||
|
return None
|
||||||
|
except User.DoesNotExist:
|
||||||
|
pass
|
||||||
try:
|
try:
|
||||||
return super(LDAPBackend, self).authenticate(username, password)
|
return super(LDAPBackend, self).authenticate(username, password)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
Reference in New Issue
Block a user