Ticket #7344 (closed enhancement: fixed)

Opened 4 years ago

Last modified 4 years ago

Retrieve Password Error Action

Reported by: axelseaa Owned by: ryan
Priority: normal Milestone: 2.6.1
Component: General Version:
Severity: normal Keywords:
Cc:

Description

I am the wpmu ldap plugin author - and I am working on a way to better handle the lost password function. The ldap plugin now supports local and ldap users, so the trick is how to handle the both of them. See the attached patch for my proposed changes. This would then allow me to run the following function:

function ldapRetrievePassword($userID,$pass_error) {

$ldap_login = get_usermeta($userID, 'ldap_login');

if ($ldap_login == true) {

get the configurable error message: $pass_error = get_site_option('ldapGetPasswordMessage');

}

} add_action('retrieve_password_error', 'ldapRetrievePassword',10,2);

Attachments

wp-login-diff.txt Download (906 bytes) - added by axelseaa 4 years ago.

Change History

comment:1   ryan4 years ago

So you want to disabled password reset if the user is using LDAP? How about we add a filter called 'allow_password_reset'?

if ( is_wp_error( $allow = apply_filters('allow_password_reset', true) ) )
   return $allow;

If the user is using ldap, I want to disable the password reset and print out an error message. But if its a local user, they should be allow to continue with the password reset process.

The filter would work if I can get at the current userid from my filter function to check a user meta value, is that possible?

comment:3   ryan4 years ago

Oh, I forgot to pass the ID in the example. That can be added as an argument after "true".

Can you show me an example of how I would call such a filter? So far i can't find any documentation, and what I've tried from reading the function declaration is not working correctly

adding the following filter would work wonders:

if ( is_wp_error( $allow = apply_filters('allow_password_reset', true, $user_data->ID) ) ) return $allow;

comment:6   ryan4 years ago

  • Owner changed from anonymous to ryan

comment:7   ryan4 years ago

  • Status changed from new to closed
  • Resolution set to fixed

(In [8400]) Allow disabling password reset per user. Props axelseaa. fixes #7344 for trunk

comment:8   ryan4 years ago

(In [8401]) Allow disabling password reset per user. Props axelseaa. fixes #7344 for 2.6

woot! thanks ryan!

  • Status changed from closed to reopened
  • Resolution fixed deleted

There is a case issue - $user_data->id should be $user_data->ID

  • Status changed from reopened to closed
  • Resolution set to fixed

(In [8411]) Fix case. fixes #7344 for trunk

(In [8412]) Fix case. fixes #7344 for 2.6

Note: See TracTickets for help on using tickets.