From 2c18bc24a73d683758620585d58705be11100e41 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 30 Aug 2016 08:34:17 -0700 Subject: [PATCH] Check if username is userprincipalname If it is, skip building the UPN for AD --- app/Models/Ldap.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/Models/Ldap.php b/app/Models/Ldap.php index 9e4b01a9a2..ea92ee3f9d 100644 --- a/app/Models/Ldap.php +++ b/app/Models/Ldap.php @@ -81,11 +81,18 @@ class Ldap extends Model if ($settings->is_ad =='1') { - // In case they haven't added an AD domain - if ($settings->ad_domain == '') { - $userDn = $username.'@'.$settings->email_domain; + // Check if they are using the userprincipalname for the username field. + // If they are, we can skip building the UPN to authenticate against AD + if ($ldap_username_field=='userprincipalname') + { + $userDn = $username; } else { - $userDn = $username.'@'.$settings->ad_domain; + // In case they haven't added an AD domain + if ($settings->ad_domain == '') { + $userDn = $username.'@'.$settings->email_domain; + } else { + $userDn = $username.'@'.$settings->ad_domain; + } } } else {