diff --git a/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/MailReset.pm b/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/MailReset.pm index a1422b746..779fb2934 100644 --- a/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/MailReset.pm +++ b/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/MailReset.pm @@ -247,6 +247,7 @@ sub changePassword { $self->{newpassword} = $password; $self->{confirmpassword} = $password; + $self->{forceReset} = 1; } # Else a password is required @@ -256,7 +257,7 @@ sub changePassword { } # Modify the password - my $result = $self->modifyPassword( $self->param('reset') ); + my $result = $self->modifyPassword(); # Mail token can be used only one time, delete the session if all is ok if ( $result == PE_PASSWORD_OK ) { diff --git a/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/PasswordDBLDAP.pm b/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/PasswordDBLDAP.pm index 542d31abc..fcd0b3673 100644 --- a/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/PasswordDBLDAP.pm +++ b/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/PasswordDBLDAP.pm @@ -30,12 +30,11 @@ sub passwordDBInit { PE_OK; } -## @apmethod int modifyPassword(boolean reset) +## @apmethod int modifyPassword() # Modify the password by LDAP mechanism. -# @param reset Force pwdReset flag to TRUE # @return Lemonldap::NG::Portal constant sub modifyPassword { - my ($self,$reset) = splice @_; + my $self = shift; # Exit method if no password change requested return PE_OK unless ( $self->{newpassword} ); @@ -66,8 +65,8 @@ sub modifyPassword { return $code unless ( $code == PE_PASSWORD_OK ); - # If Password Policy and reset asked, set the PwdReset flag - if ( $self->{ldapPpolicyControl} and $reset) { + # If password policy and force reset, set pwdReset flag + if ( $self->{ldapPpolicyControl} and $self->{forceReset} ) { my $result = $self->ldap->modify( $self->{dn}, replace => { 'pwdReset' => 'TRUE' } );