markleary / grav-plugin-loginldap

Grav LoginLdap Plugin http://getgrav.org
MIT License
5 stars 4 forks source link

Error after entering credentials #4

Closed rbukovansky closed 7 years ago

rbukovansky commented 7 years ago

When my user enters credentials on login page, I'm getting this error:

Whoops \ Exception \ ErrorException (E_NOTICE)
Undefined index: Grav\Plugin\LoginLdap\

screen shot 2017-03-08 at 14 10 43

@markleary Any idea, what's going on, please? Thanks.

markleary commented 7 years ago

That is strange, seems like an issue with the way composer is configured. What version of PHP and Grav are you using?

rbukovansky commented 7 years ago

PHP 7.0.16 (Fedora 25) Grav 1.1.17

markleary commented 7 years ago

Ok, I'm using php 5.5 but this part of the code was just copied from grav-plugin-login so if that is php7 compatible this should be too. Try rebuilding the composer files with:

php /path/to/grav_root/bin/composer.phar update

Run this from the loginldap plugin directory.

rbukovansky commented 7 years ago

OK. I got this from that command:

Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 1 update, 0 removals
  - Installing paragonie/random_compat (v1.4.1) Downloading: 100%
  - Updating birke/rememberme (1.0.4 => 1.0.5) Downloading: 100%
paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
Writing lock file
Generating autoload files

and this error after reload of page:

Whoops \ Exception \ ErrorException (E_WARNING)
ldap_search(): Search: Protocol error

screen shot 2017-03-08 at 19 29 28

markleary commented 7 years ago

Google is not showing much for "ldap_search() Protocol error". What LDAP server are you using? If you haven't already, it's probably worth verifying a simple example like this works for you:

http://php.net/manual/en/ldap.examples-basic.php

markleary commented 7 years ago

Also, can you share your loginldap.yaml minus anything sensitive.

rbukovansky commented 7 years ago

OK. I just solved this.

  1. Probably that composer update is needed.
  2. For OpenLDAP server I have changed this line in loginldap.yaml:
    user_filter: '(&(objectClass=user)(sAMAccountName=%s))'

    to this:

    user_filter: '(&(objectClass=posixAccount)(uid=%s))'

and voila!

Thanks.

markleary commented 7 years ago

Ok great, I ran composer update on my end and commited, hopefully that fixes it.