|
|
|
@ -387,33 +387,7 @@ sub changePwd { |
|
|
|
$self->logger->debug( |
|
|
|
$self->logger->debug( |
|
|
|
"Reset password request for $req->{sessionInfo}->{_user}"); |
|
|
|
"Reset password request for $req->{sessionInfo}->{_user}"); |
|
|
|
|
|
|
|
|
|
|
|
# Generate a complex password |
|
|
|
my $password = $self->newPassword($req, $req->sessionInfo); |
|
|
|
my $pwdRegEx; |
|
|
|
|
|
|
|
if ( $self->passwordPolicyActivationRule->( $req, $req->sessionInfo ) |
|
|
|
|
|
|
|
&& !$self->conf->{randomPasswordRegexp} ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
my $uppers = $self->conf->{passwordPolicyMinUpper} || 3; |
|
|
|
|
|
|
|
my $lowers = $self->conf->{passwordPolicyMinLower} || 5; |
|
|
|
|
|
|
|
my $digits = $self->conf->{passwordPolicyMinDigit} || 2; |
|
|
|
|
|
|
|
my $chars = |
|
|
|
|
|
|
|
$self->conf->{passwordPolicyMinSize} - |
|
|
|
|
|
|
|
$self->conf->{passwordPolicyMinUpper} - |
|
|
|
|
|
|
|
$self->conf->{passwordPolicyMinLower} - |
|
|
|
|
|
|
|
$self->conf->{passwordPolicyMinDigit}; |
|
|
|
|
|
|
|
$chars = 1 if $chars < 1; |
|
|
|
|
|
|
|
$pwdRegEx = "[A-Z]{$uppers}[a-z]{$lowers}\\d{$digits}"; |
|
|
|
|
|
|
|
$pwdRegEx .= |
|
|
|
|
|
|
|
$self->conf->{passwordPolicySpecialChar} eq '__ALL__' |
|
|
|
|
|
|
|
? '\W{$chars}' |
|
|
|
|
|
|
|
: "[$self->{conf}->{passwordPolicySpecialChar}]{$chars}"; |
|
|
|
|
|
|
|
$self->logger->debug("Generated password RegEx: $pwdRegEx"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
$pwdRegEx = |
|
|
|
|
|
|
|
$self->conf->{randomPasswordRegexp} || '[A-Z]{3}[a-z]{5}.\d{2}'; |
|
|
|
|
|
|
|
$self->logger->debug("Used password RegEx: $pwdRegEx"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
my $password = $self->gen_password($pwdRegEx); |
|
|
|
|
|
|
|
$self->logger->debug("Generated password: $password"); |
|
|
|
$self->logger->debug("Generated password: $password"); |
|
|
|
$req->data->{newpassword} = $password; |
|
|
|
$req->data->{newpassword} = $password; |
|
|
|
$req->data->{confirmpassword} = $password; |
|
|
|
$req->data->{confirmpassword} = $password; |
|
|
|
@ -438,13 +412,7 @@ sub changePwd { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# Check password quality if enabled |
|
|
|
# Check password quality if enabled |
|
|
|
require Lemonldap::NG::Portal::Plugins::BasePasswordPolicy; |
|
|
|
my $cpq = $self->checkPasswordQuality($req, $req->data->{newpassword}); |
|
|
|
my $cpq = |
|
|
|
|
|
|
|
$self->passwordPolicyActivationRule->( $req, $req->sessionInfo ) |
|
|
|
|
|
|
|
? $self |
|
|
|
|
|
|
|
->Lemonldap::NG::Portal::Plugins::BasePasswordPolicy::checkBasicPolicy( |
|
|
|
|
|
|
|
$req->data->{newpassword} ) |
|
|
|
|
|
|
|
: PE_OK; |
|
|
|
|
|
|
|
unless ( $cpq == PE_OK ) { |
|
|
|
unless ( $cpq == PE_OK ) { |
|
|
|
$self->ott->setToken( $req, $req->sessionInfo ); |
|
|
|
$self->ott->setToken( $req, $req->sessionInfo ); |
|
|
|
return $cpq; |
|
|
|
return $cpq; |
|
|
|
|