Add an option to force getUser before LDAP password change (#714)

v2.11
Maxime Besson 4 years ago
parent 9d24e5f0d5
commit 6517718f26
  1. 6
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Password/AD.pm
  2. 5
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Password/LDAP.pm

@ -30,6 +30,12 @@ sub confirm {
sub modifyPassword {
my ( $self, $req, $pwd, $useMail ) = @_;
# If the password change is done in a different backend,
# we need to reload the correct DN
$self->getUser( $req, useMail => $useMail )
if $self->conf->{ldapGetUserBeforePasswordChange};
my $dn = $req->data->{dn} || $req->sessionInfo->{_dn};
unless ($dn) {
$self->logger->error('"dn" is not set, abort password modification');

@ -32,6 +32,11 @@ sub modifyPassword {
my $dn;
my $requireOldPassword;
# If the password change is done in a different backend,
# we need to reload the correct DN
$self->getUser( $req, useMail => $useMail )
if $self->conf->{ldapGetUserBeforePasswordChange};
if ( $req->data->{dn} ) {
$dn = $req->data->{dn};
$requireOldPassword = $self->requireOldPwdRule->( $req, $req->userData );

Loading…
Cancel
Save