Commit 5a4d27bc authored by Xavier Guimard's avatar Xavier Guimard

Remove some old files (#595)

parent eb61ccda
......@@ -94,11 +94,7 @@ lib/Lemonldap/NG/Portal/Password/Base.pm
lib/Lemonldap/NG/Portal/Password/DBI.pm
lib/Lemonldap/NG/Portal/Password/Demo.pm
lib/Lemonldap/NG/Portal/Password/LDAP.pm
lib/Lemonldap/NG/Portal/PasswordDBAD.pm
lib/Lemonldap/NG/Portal/PasswordDBChoice.pm
lib/Lemonldap/NG/Portal/PasswordDBDBI.pm
lib/Lemonldap/NG/Portal/PasswordDBLDAP.pm
lib/Lemonldap/NG/Portal/PasswordDBNull.pm
lib/Lemonldap/NG/Portal/Plugins/CDA.pm
lib/Lemonldap/NG/Portal/Plugins/ForceAuth.pm
lib/Lemonldap/NG/Portal/Plugins/Notifications.pm
......
##@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 = '2.0.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
my $code =
$self->ldap->userModifyPassword( $self->{dn}, $self->{newpassword},
$self->{confirmpassword},
$self->{oldpassword}, 1 );
return $code unless ( $code == PE_PASSWORD_OK );
# If force reset, set reset flag
if ( $self->{forceReset} ) {
my $result =
$self->ldap->modify( $self->{dn},
replace => { 'pwdLastSet' => '0' } );
unless ( $result->code == 0 ) {
$self->lmLog( "LDAP modify pwdLastSet error: " . $result->code,
'error' );
$code = PE_LDAPERROR;
}
$self->lmLog( "pwdLastSet set to 0", 'debug' );
}
return $code;
}
1;
##@file
# DBI password backend file
##@class
# DBI password backend class
package Lemonldap::NG::Portal::PasswordDBDBI;
use strict;
use Lemonldap::NG::Portal::Simple;
use Lemonldap::NG::Portal::AuthDBI; #inherits
use base qw(Lemonldap::NG::Portal::_DBI );
#inherits Lemonldap::NG::Portal::_SMTP
our $VERSION = '2.0.0';
## @apmethod int passwordDBInit()
# Load SMTP functions and call DBI authInit()
# @return Lemonldap::NG::Portal constant
sub passwordDBInit {
my $self = shift;
eval { use base qw(Lemonldap::NG::Portal::_SMTP) };
if ($@) {
$self->lmLog( "Unable to load SMTP functions ($@)", 'error' );
return PE_ERROR;
}
unless ( $self->{dbiPasswordMailCol} ) {
$self->lmLog( "Missing configuration parameters for DBI password reset",
'error' );
return PE_ERROR;
}
return $self->Lemonldap::NG::Portal::AuthDBI::authInit();
}
## @apmethod int modifyPassword()
# Modify the password
# @return Lemonldap::NG::Portal constant
sub modifyPassword {
my $self = shift;
# Exit if no password change requested
return PE_OK unless ( $self->{newpassword} );
# Check if portal require old password
if ( $self->{portalRequireOldPassword} ) {
unless ( $self->{oldpassword} ) {
$self->lmLog( "Portal require old password", 'error' );
return PE_PP_MUST_SUPPLY_OLD_PASSWORD;
}
}
# Verify confirmation password matching
return PE_PASSWORD_MISMATCH
unless ( $self->{newpassword} eq $self->{confirmpassword} );
# Connect
my $dbh =
$self->dbh( $self->{dbiAuthChain}, $self->{dbiAuthUser},
$self->{dbiAuthPassword} );
return PE_ERROR unless $dbh;
my $user = $self->{sessionInfo}->{_user};
# Check old password
if ( $self->{oldpassword} ) {
my $result = $self->check_password( $dbh, $user, $self->{oldpassword} );
unless ($result) {
return PE_BADOLDPASSWORD;
}
}
# Modify password
my $result = $self->modify_password( $user, $self->{newpassword} );
unless ($result) {
return PE_ERROR;
}
$self->lmLog( "Password changed for $user", 'debug' );
PE_PASSWORD_OK;
}
1;
##@file
# LDAP password backend file
##@class
# LDAP password backend class
package Lemonldap::NG::Portal::PasswordDBLDAP;
use strict;
use Lemonldap::NG::Portal::Simple;
use Lemonldap::NG::Portal::_LDAP 'ldap'; #link protected ldap
use Lemonldap::NG::Portal::UserDBLDAP; #inherits
#inherits Lemonldap::NG::Portal::_SMTP
our $VERSION = '2.0.0';
*_formateFilter = *Lemonldap::NG::Portal::UserDBLDAP::formateFilter;
*_search = *Lemonldap::NG::Portal::UserDBLDAP::search;
## @apmethod int passwordDBInit()
# Load SMTP functions
# @return Lemonldap::NG::Portal constant
sub passwordDBInit {
my $self = shift;
eval { use base qw(Lemonldap::NG::Portal::_SMTP) };
if ($@) {
$self->lmLog( "Unable to load SMTP functions ($@)", 'error' );
return PE_ERROR;
}
PE_OK;
}
## @apmethod int modifyPassword()
# Modify the password by LDAP mechanism.
# @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
my $code = $self->ldap->userModifyPassword(
$self->{dn}, $self->{newpassword},
$self->{confirmpassword}, $self->{oldpassword}
);
unless ( $code == PE_PASSWORD_OK ) {
$self->ldap->unbind;
$self->{flags}->{ldapActive} = 0;
return $code;
}
# If password policy and force reset, set reset flag
if ( $self->{ldapPpolicyControl}
and $self->{forceReset}
and $self->{ldapUsePasswordResetAttribute} )
{
my $result = $self->ldap->modify(
$self->{dn},
replace => {
$self->{ldapPasswordResetAttribute} =>
$self->{ldapPasswordResetAttributeValue}
}
);
unless ( $result->code == 0 ) {
$self->lmLog(
"LDAP modify "
. $self->{ldapPasswordResetAttribute}
. " error: "
. $result->code,
'error'
);
$self->ldap->unbind;
$self->{flags}->{ldapActive} = 0;
return PE_LDAPERROR;
}
$self->lmLog(
$self->{ldapPasswordResetAttribute}
. " set to "
. $self->{ldapPasswordResetAttributeValue},
'debug'
);
}
return $code;
}
## @apmethod int passwordDBFinish()
# Unbind.
# @return Lemonldap::NG::Portal constant
sub passwordDBFinish {
my $self = shift;
if ( ref( $self->{ldap} ) && $self->{flags}->{ldapActive} ) {
$self->ldap->unbind();
$self->{flags}->{ldapActive} = 0;
}
PE_OK;
}
1;
##@file
# Null password backend file
##@class
# Null password backend class
package Lemonldap::NG::Portal::PasswordDBNull;
use strict;
use Lemonldap::NG::Portal::Simple;
our $VERSION = '2.0.0';
## @apmethod int passwordDBInit()
# Does nothing
# @return Lemonldap::NG::Portal constant
sub passwordDBInit {
PE_OK;
}
## @apmethod int modifyPassword()
# Does nothing
# @return Lemonldap::NG::Portal constant
sub modifyPassword {
PE_OK;
}
1;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment