parent
057a8afcb2
commit
252ac57692
|
@ -2,7 +2,8 @@ package Lemonldap::NG::Portal::Password::LDAP;
|
|||
|
||||
use strict;
|
||||
use Mouse;
|
||||
use Lemonldap::NG::Portal::Main::Constants qw(PE_PASSWORD_OK PE_LDAPERROR);
|
||||
use Lemonldap::NG::Portal::Main::Constants
|
||||
qw(PE_PASSWORD_OK PE_LDAPERROR PE_ERROR);
|
||||
|
||||
extends 'Lemonldap::NG::Portal::Lib::LDAP',
|
||||
'Lemonldap::NG::Portal::Password::Base';
|
||||
|
@ -23,10 +24,15 @@ sub confirm {
|
|||
|
||||
sub modifyPassword {
|
||||
my ( $self, $req, $pwd ) = @_;
|
||||
my $dn = $req->userData->{_dn} || $req->sessionInfo->{_dn};
|
||||
unless ($dn) {
|
||||
$self->logger->error('"dn" is not set, aborting password modification');
|
||||
return PE_ERROR;
|
||||
}
|
||||
|
||||
# Call the modify password method
|
||||
my $code = $self->ldap->userModifyPassword( $req->userData->{_dn},
|
||||
$pwd, $req->datas->{oldpassword} );
|
||||
my $code =
|
||||
$self->ldap->userModifyPassword( $dn, $pwd, $req->datas->{oldpassword} );
|
||||
|
||||
unless ( $code == PE_PASSWORD_OK ) {
|
||||
$self->ldap->unbind;
|
||||
|
@ -40,7 +46,7 @@ sub modifyPassword {
|
|||
and $self->conf->{ldapUsePasswordResetAttribute} )
|
||||
{
|
||||
my $result = $self->ldap->modify(
|
||||
$req->datas->{dn},
|
||||
$dn,
|
||||
replace => {
|
||||
$self->conf->{ldapPasswordResetAttribute} =>
|
||||
$self->conf->{ldapPasswordResetAttributeValue}
|
||||
|
|
|
@ -325,7 +325,7 @@ sub _reset {
|
|||
$body =~ s/\$expMailDate/$req->datas->{expMailDate}/ge;
|
||||
$body =~ s/\$expMailTime/$req->datas->{expMailTime}/ge;
|
||||
$body =~ s/\$url/$url/g;
|
||||
$body =~ s/\$(\w+)/$req->{sessionInfo}->{$1}/ge;
|
||||
$body =~ s/\$(\w+)/$req->{sessionInfo}->{$1} || ''/ge;
|
||||
|
||||
# Send mail
|
||||
unless (
|
||||
|
@ -443,7 +443,7 @@ sub changePwd {
|
|||
# Replace variables in body
|
||||
my $password = $req->datas->{newpassword};
|
||||
$body =~ s/\$password/$password/g;
|
||||
$body =~ s/\$(\w+)/$req->{sessionInfo}->{$1}/ge;
|
||||
$body =~ s/\$(\w+)/$req->{sessionInfo}->{$1} || ''/ge;
|
||||
|
||||
# Send mail
|
||||
return PE_MAILERROR
|
||||
|
|
|
@ -35,7 +35,7 @@ SKIP: {
|
|||
my $client = LLNG::Manager::Test->new(
|
||||
{
|
||||
ini => {
|
||||
logLevel => 'debug',
|
||||
logLevel => 'error',
|
||||
useSafeJail => 1,
|
||||
portalDisplayRegister => 1,
|
||||
authentication => 'DBI',
|
||||
|
@ -102,8 +102,8 @@ SKIP: {
|
|||
|
||||
#print STDERR Dumper($query);
|
||||
}
|
||||
|
||||
eval { unlink 't/userdb.db' };
|
||||
count($maintests);
|
||||
|
||||
clean_sessions();
|
||||
|
||||
done_testing( count() );
|
||||
|
|
|
@ -28,7 +28,7 @@ SKIP: {
|
|||
my $client = LLNG::Manager::Test->new(
|
||||
{
|
||||
ini => {
|
||||
logLevel => 'debug',
|
||||
logLevel => 'error',
|
||||
useSafeJail => 1,
|
||||
portalDisplayRegister => 1,
|
||||
authentication => 'LDAP',
|
||||
|
|
|
@ -25,7 +25,7 @@ SKIP: {
|
|||
my $client = LLNG::Manager::Test->new(
|
||||
{
|
||||
ini => {
|
||||
logLevel => 'debug',
|
||||
logLevel => 'error',
|
||||
useSafeJail => 1,
|
||||
portalDisplayRegister => 1,
|
||||
authentication => 'Demo',
|
||||
|
|
Loading…
Reference in New Issue