58 lines
1.4 KiB
Perl
58 lines
1.4 KiB
Perl
##@file
|
|
# AD password backend file
|
|
|
|
##@class
|
|
# AD password backend class
|
|
package Lemonldap::NG::Portal::PasswordDBAD;
|
|
|
|
use strict;
|
|
use Lemonldap::NG::Portal::Simple;
|
|
|
|
#inherits Lemonldap::NG::Portal::_SMTP
|
|
|
|
our $VERSION = '1.3.0';
|
|
|
|
use base qw(Lemonldap::NG::Portal::PasswordDBLDAP);
|
|
|
|
*_formateFilter = *Lemonldap::NG::Portal::UserDBAD::formateFilter;
|
|
*_search = *Lemonldap::NG::Portal::UserDBAD::search;
|
|
|
|
## @apmethod int modifyPassword()
|
|
# Modify the password by LDAP mechanism.
|
|
# Use AD specific method
|
|
# @return Lemonldap::NG::Portal constant
|
|
sub modifyPassword {
|
|
my $self = shift;
|
|
|
|
# Exit method if no password change requested
|
|
return PE_OK unless ( $self->{newpassword} );
|
|
|
|
unless ( $self->ldap ) {
|
|
return PE_LDAPCONNECTFAILED;
|
|
}
|
|
|
|
# Set the dn unless done before
|
|
unless ( $self->{dn} ) {
|
|
my $tmp = $self->_subProcess(qw(_formateFilter _search));
|
|
return $tmp if ($tmp);
|
|
}
|
|
|
|
$self->lmLog( "Modify password request for " . $self->{dn}, 'debug' );
|
|
|
|
# Call the modify password method for AD
|
|
# TODO
|
|
my $code = $self->ldap->userModifyADPassword(
|
|
$self->{dn}, $self->{newpassword},
|
|
$self->{confirmpassword}, $self->{oldpassword}
|
|
);
|
|
|
|
return $code unless ( $code == PE_PASSWORD_OK );
|
|
|
|
# If password policy and force reset, set reset flag
|
|
# TODO
|
|
|
|
return $code;
|
|
}
|
|
|
|
1;
|