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

Check for already successfull authentication before "reauthenticating" #81

Closed
heiglandreas opened this issue Oct 15, 2015 · 1 comment
Closed

Comments

@heiglandreas
Copy link
Owner

This is an issue reported at https://wordpress.org/support/topic/authldap-doesnt-work-with-other-auth-plugins.

@litinoveweedle
Copy link

Hello heiglandreas,

sorry my mistake, I am use too much to PHP and WP, so steep learning curve for me.

I suggest better and simpler check based on WP_User object, this should do the trick:


  function authLdap_login($user, $username, $password, $already_md5 = false)
  {
    // don't do anything when authLDAP is disabled
    if (! authLdap_get_option('Enabled')) {
        authLdap_debug('LDAP disabled in AuthLDAP plugin options (use the first option in the AuthLDAP options to enable it)');
        return $user;
    }
    if (isset($user) && $user->ID) {
        return $user;
    }
    authLdap_debug("User '$username' logging in");

As for the rest of the answer why not provide configurable options of fallback? i.e. if user is already authenticated by previous hook would you really like to force http auth anyway?

Kind regards
Litin

heiglandreas added a commit that referenced this issue Oct 17, 2015
This adds code that honors an already successfull authentication.

As the first parameter to the login-function is either "NULL" when no
authentication attempt has happened or WP_Error when a previous
login-attempt has failed or WP_User when a previous login-attempt
already has been successfull. Therefore when the first parameter is an
instance of WP_USer we now instantly return that instance without
further processing.

This has been reported in issue #81 by
[litinoveweedle](https://github.com/litinoveweedle)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants