Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined index: username #7

Closed
mogilny opened this issue Aug 22, 2013 · 1 comment
Closed

Undefined index: username #7

mogilny opened this issue Aug 22, 2013 · 1 comment

Comments

@mogilny
Copy link

mogilny commented Aug 22, 2013

I have found a litte bug in the function getAuthIdentifier in the file LdapUser.php on Line 24

public function getAuthIdentifier()
{
   $username = (Config::has('auth.username_field')) ? Config::get('auth.username_field') : 'username';
    return $this->attributes[$username];
}

If you habe defined an 'fields' array (I did it in my Laravel 4 config/auth.php file), then you need to explicity set a field 'username' => 'samaccountname',. Otherwise the lookup will file and fire an Undefined index: username error.

The function mentioned above should be re-written to

public function getAuthIdentifier()
{
    //_'username'_ changed to _$this->attributes['username'] = 'username'_
    $username = (Config::has('auth.username_field')) ? Config::get('auth.username_field') : $this->attributes['username'] = 'username';
    return $this->attributes[$username];
}

With this litte modification, the authication works fine, even if no username field is defiend.

@ccovey
Copy link
Owner

ccovey commented Aug 24, 2013

if you set a field other than username then you need to define username_field to that same key.

@ccovey ccovey closed this as completed Aug 24, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants