Skip to content

Commit

Permalink
Check if username is userprincipalname
Browse files Browse the repository at this point in the history
If it is, skip building the UPN for AD
  • Loading branch information
snipe committed Aug 30, 2016
1 parent f81b212 commit 2c18bc2
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions app/Models/Ldap.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,18 @@ static function findAndBindUserLdap($username, $password)
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 {
Expand Down

0 comments on commit 2c18bc2

Please sign in to comment.