Fix password change as user for AD (#704)

This commit is contained in:
Clément Oudot 2014-05-21 12:43:04 +00:00
parent 85e9b0f0fb
commit 233026eb6f
2 changed files with 8 additions and 5 deletions

View File

@ -12,7 +12,7 @@ use Lemonldap::NG::Portal::_LibAccess;
use base qw(Lemonldap::NG::Portal::_LibAccess); use base qw(Lemonldap::NG::Portal::_LibAccess);
use Clone qw(clone); use Clone qw(clone);
our $VERSION = '1.3.0'; our $VERSION = '1.4.0';
our $catlevel = 0; our $catlevel = 0;
## @method void menuInit() ## @method void menuInit()
@ -57,6 +57,7 @@ sub menuInit {
scalar( scalar(
grep { $_ == $self->{menuError} } ( grep { $_ == $self->{menuError} } (
25, #PE_PP_CHANGE_AFTER_RESET 25, #PE_PP_CHANGE_AFTER_RESET
26, #PE_PP_PASSWORD_MOD_NOT_ALLOWED
27, #PE_PP_MUST_SUPPLY_OLD_PASSWORD 27, #PE_PP_MUST_SUPPLY_OLD_PASSWORD
28, #PE_PP_INSUFFICIENT_PASSWORD_QUALITY 28, #PE_PP_INSUFFICIENT_PASSWORD_QUALITY
29, #PE_PP_PASSWORD_TOO_SHORT 29, #PE_PP_PASSWORD_TOO_SHORT

View File

@ -302,13 +302,13 @@ sub userModifyPassword {
# AD specific # AD specific
# Change password as user with a delete/add modification # Change password as user with a delete/add modification
if ( $ad and $oldpassword and $asUser ) { if ( $ad and $oldpassword and $asUser ) {
$mesg = $self->modify( $mesg = $self->modify(
$dn, $dn,
delete => { $passwordAttribute => $oldpassword }, changes => [
add => { $passwordAttribute => $newpassword } delete => [ $passwordAttribute => $oldpassword ],
add => [ $passwordAttribute => $newpassword ]
]
); );
} }
else { else {
@ -339,6 +339,8 @@ sub userModifyPassword {
if ( $mesg->code == 50 || $mesg->code == 8 ); if ( $mesg->code == 50 || $mesg->code == 8 );
return PE_PP_INSUFFICIENT_PASSWORD_QUALITY return PE_PP_INSUFFICIENT_PASSWORD_QUALITY
if ( $mesg->code == 53 && $ad ); if ( $mesg->code == 53 && $ad );
return PE_PP_PASSWORD_MOD_NOT_ALLOWED
if ( $mesg->code == 19 && $ad );
return PE_LDAPERROR unless ( $mesg->code == 0 ); return PE_LDAPERROR unless ( $mesg->code == 0 );
$self->{portal} $self->{portal}
->_sub( 'userNotice', "Password changed $self->{portal}->{user}" ); ->_sub( 'userNotice', "Password changed $self->{portal}->{user}" );