WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#7344 closed enhancement (fixed)

Retrieve Password Error Action

Reported by: axelseaa Owned by: ryan
Milestone: 2.6.1 Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: 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 (1)

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

Download all attachments as: .zip

Change History (13)

@axelseaa7 years ago

comment:1 @ryan7 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;

comment:2 @axelseaa7 years ago

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 @ryan7 years ago

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

comment:4 @axelseaa7 years ago

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

comment:5 @axelseaa7 years ago

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 @ryan7 years ago

  • Owner changed from anonymous to ryan

comment:7 @ryan7 years ago

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

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

comment:8 @ryan7 years ago

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

comment:9 @axelseaa7 years ago

woot! thanks ryan!

comment:10 @axelseaa7 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

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

comment:11 @ryan7 years ago

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

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

comment:12 @ryan7 years ago

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

Note: See TracTickets for help on using tickets.