diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/CertificateResetByMail/LDAP.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/CertificateResetByMail/LDAP.pm index 601178d33..27c3afede 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/CertificateResetByMail/LDAP.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/CertificateResetByMail/LDAP.pm @@ -11,7 +11,7 @@ use Lemonldap::NG::Portal::Main::Constants qw( extends 'Lemonldap::NG::Portal::Lib::LDAP'; -our $VERSION = '2.0.0'; +our $VERSION = '2.1.0'; # RUNNING METHODS diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Constants.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Constants.pm index f48665fb2..b10ee0bfe 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Constants.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Constants.pm @@ -99,7 +99,7 @@ use constant { PE_IMPERSONATION_SERVICE_NOT_ALLOWED => 93, PE_ISSUERMISSINGREQATTR => 94, PE_RESETCERTIFICATE_INVALID => 95, - PE_RESETCERTIFICATE_FOREMPTY => 96, + PE_RESETCERTIFICATE_FORMEMPTY => 96, PE_RESETCERTIFICATE_FIRSTACCESS => 97, }; @@ -196,7 +196,7 @@ sub portalConsts { '93' => 'PE_IMPERSONATION_SERVICE_NOT_ALLOWED', '94' => 'PE_ISSUERMISSINGREQATTR', '95' => 'PE_RESETCERTIFICATE_INVALID', - '96' => 'PE_RESETCERTIFICATE_FOREMPTY', + '96' => 'PE_RESETCERTIFICATE_FORMEMPTY', '97' => 'PE_RESETCERTIFICATE_FIRSTACCESS' }; @@ -297,7 +297,7 @@ our @EXPORT_OK = ( 'PE_IMPERSONATION_SERVICE_NOT_ALLOWED', 'PE_ISSUERMISSINGREQATTR', 'PE_RESETCERTIFICATE_INVALID', - 'PE_RESETCERTIFICATE_FOREMPTY', + 'PE_RESETCERTIFICATE_FORMEMPTY', 'PE_RESETCERTIFICATE_FIRSTACCESS' ); our %EXPORT_TAGS = ( 'all' => [ @EXPORT_OK, 'import' ], ); diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Request.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Request.pm index 4082c1bb8..9f55136b8 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Request.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Request.pm @@ -108,7 +108,7 @@ sub error_type { PE_CONFIRM, PE_MAILFORMEMPTY, PE_MAILCONFIRMATION_ALREADY_SENT, PE_PASSWORDFORMEMPTY, PE_CAPTCHAEMPTY, PE_REGISTERFORMEMPTY, - PE_PP_CHANGE_AFTER_RESET, PE_RESETCERTIFICATE_FOREMPTY, + PE_PP_CHANGE_AFTER_RESET, PE_RESETCERTIFICATE_FORMEMPTY, ) ) ); diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/CertificateResetByMail.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/CertificateResetByMail.pm index 7d4fca7ff..b8ef82be2 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/CertificateResetByMail.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/CertificateResetByMail.pm @@ -30,7 +30,7 @@ use Lemonldap::NG::Portal::Main::Constants qw( PE_TOKENEXPIRED PE_USERNOTFOUND PE_RESETCERTIFICATE_INVALID - PE_RESETCERTIFICATE_FOREMPTY + PE_RESETCERTIFICATE_FORMEMPTY PE_RESETCERTIFICATE_FIRSTACCESS ); @@ -61,7 +61,6 @@ has registerModule => ( is => 'rw' ); has captcha => ( is => 'rw' ); # certificate reset url - has certificateResetUrl => ( is => 'rw', lazy => 1, @@ -132,13 +131,9 @@ sub _certificateReset { my ( $mailToken, %tplPrms ); # CertificatReset FORM => modifyCertificate() - if ( - $req->method =~ /^POST$/i - - and ( $req->uploads->{certif} ) - ) + if ( $req->method =~ /^POST$/i + and ( $req->uploads->{certif} ) ) { - my $upload = $req->uploads->{certif}; return $self->modifyCertificate($req); @@ -177,7 +172,7 @@ sub _certificateReset { $searchByMail = 0 unless ( $req->{user} =~ /\@/ ); } - # Check for values posted + # Check for posted values else { # Use submitted value @@ -340,12 +335,10 @@ sub _certificateReset { 'Reset mail already sent to ' . $req->{user} ); # Return mail already sent only if it is allowed at previous step - if ( $self->conf->{portalErrorOnMailNotFound} ) { $self->setSecurity($req); return PE_MAILCONFIRMATION_ALREADY_SENT; } - } # Get mail address @@ -420,7 +413,7 @@ sub _certificateReset { } ); return PE_RESETCERTIFICATE_FIRSTACCESS if ( $req->method eq 'GET' ); - return PE_RESETCERTIFICATE_FOREMPTY; + return PE_RESETCERTIFICATE_FORMEMPTY; } sub modifyCertificate { @@ -458,8 +451,7 @@ sub modifyCertificate { #Updload certificate my $upload = $req->uploads->{certif}; - - unless ( $upload->size > 0 ) { return PE_RESETCERTIFICATE_FOREMPTY; } + unless ( $upload->size > 0 ) { return PE_RESETCERTIFICATE_FORMEMPTY; } # Get Certificate @@ -498,7 +490,7 @@ sub modifyCertificate { "Certificate will expire after $notAfter, Issuer $x509issuer and serialNumber $x509serial" ); - # Check Certificate Validity befor store + # Check Certificate Validity before store if ( $self->checkCertificateValidity( $notAfter, $self->conf->{certificateResetByMailValidityDelay} ) == 0 @@ -512,7 +504,7 @@ sub modifyCertificate { #return PE_PASSWORD_MISMATCH; } - # Build serial number hex exemple f3:08:52:63:28:29:fa:e2 + # Build serial number hex: example f3:08:52:63:28:29:fa:e2 my @numberstring = split //, lc($x509serial); my $serial = ""; @@ -534,11 +526,9 @@ sub modifyCertificate { $self->userLogger->debug( "Description:: " . $certificatExactAssertion ); # Get attribut userCertificate;binary value - my $cert = $self->certificateHash($file); # modif the ldap certificate attribute - $req->user( $req->{sessionInfo}->{_user} ); my $result = $self->registerModule->modifCertificate( $certificatExactAssertion, @@ -690,7 +680,7 @@ sub display { } # Display Certificate Reset form again if certificate invalid - elsif ($req->error == PE_RESETCERTIFICATE_FOREMPTY + elsif ($req->error == PE_RESETCERTIFICATE_FORMEMPTY || $req->error == PE_RESETCERTIFICATE_INVALID ) { $self->logger->debug('Display Certificate Reset form');