Commit 10e8d514 authored by Xavier Guimard's avatar Xavier Guimard

Fix Perl::Critic changes

parent 2159957c
......@@ -84,7 +84,7 @@ sub resetPwd {
sub _reset {
my ( $self, $req ) = @_;
my ( $mailToken, $newPwd, $confirmPwd, %tplPrms );
my ( $mailToken, %tplPrms );
# PASSWORD CHANGE FORM => changePwd()
if (
......@@ -109,7 +109,7 @@ sub _reset {
# OTHER FORMS
if ($mailToken) {
$self->logger->debug( "Token given for password reset: " . $mailToken );
$self->logger->debug( "Token given for password reset: $mailToken" );
# Check if token is valid
my $mailSession = $self->p->getApacheSession($mailToken);
......@@ -166,7 +166,7 @@ sub _reset {
$self->setSecurity($req);
return PE_CAPTCHAERROR;
}
$self->logger->debug("Captcha code verified");
$self->logger->debug('Captcha code verified');
}
elsif ( $self->conf->{requireToken} ) {
unless ( $self->ott->getToken($token) ) {
......@@ -190,9 +190,9 @@ sub _reset {
);
if ( my $error = $self->p->process( $req, useMail => $searchByMail ) ) {
if ( $error == PE_USERNOTFOUND or $error == PE_BADCREDENTIALS ) {
$self->userLogger->warn( "Reset asked for an unvalid user ("
$self->userLogger->warn( 'Reset asked for an unvalid user ('
. $req->param('mail')
. ")" );
. ')' );
# To avoid mail enumeration, return OK
# unless portalErrorOnMailNotFound is set
......@@ -206,9 +206,9 @@ sub _reset {
$self->conf->{mailTimeout} || $self->conf->{timeout};
my $expTimestamp = time() + $mailTimeout;
$req->data->{expMailDate} =
strftime( "%d/%m/%Y", localtime $expTimestamp );
strftime( '%d/%m/%Y', localtime $expTimestamp );
$req->data->{expMailTime} =
strftime( "%H:%M", localtime $expTimestamp );
strftime( '%H:%M', localtime $expTimestamp );
return PE_MAILCONFIRMOK;
}
return $error;
......@@ -245,7 +245,7 @@ sub _reset {
$infos->{user} = $req->{user};
# Store type
$infos->{_type} = "mail";
$infos->{_type} = 'mail';
# Store pdata
$infos->{_pdata} = $req->pdata;
......@@ -270,22 +270,22 @@ sub _reset {
$self->logger->debug("Mail expiration timestamp: $expTimestamp");
$req->data->{expMailDate} =
strftime( "%d/%m/%Y", localtime $expTimestamp );
strftime( '%d/%m/%Y', localtime $expTimestamp );
$req->data->{expMailTime} =
strftime( "%H:%M", localtime $expTimestamp );
strftime( '%H:%M', localtime $expTimestamp );
# Mail session start date
my $startTimestamp = $mailSession->data->{mailSessionStartTimestamp};
$self->logger->debug("Mail start timestamp: $startTimestamp");
$req->data->{startMailDate} =
strftime( "%d/%m/%Y", localtime $startTimestamp );
strftime( '%d/%m/%Y', localtime $startTimestamp );
$req->data->{startMailTime} =
strftime( "%H:%M", localtime $startTimestamp );
strftime( '%H:%M', localtime $startTimestamp );
# Ask if user wants an another confirmation email
if ( $req->data->{mailAlreadySent}
and !$req->param('resendconfirmation') )
and not $req->param('resendconfirmation') )
{
$self->userLogger->notice(
'Reset mail already sent to ' . $req->{user} );
......@@ -405,13 +405,13 @@ sub changePwd {
# Check if user wants to generate the new password
if ( $req->param('reset') ) {
$self->logger->debug(
"Reset password request for " . $req->{sessionInfo}->{_user} );
"Reset password request for $req->{sessionInfo}->{_user}" );
# Generate a complex password
my $password =
$self->gen_password( $self->conf->{randomPasswordRegexp} );
$self->logger->debug( "Generated password: " . $password );
$self->logger->debug( "Generated password: $password" );
$req->data->{newpassword} = $password;
$req->data->{confirmpassword} = $password;
......@@ -490,7 +490,7 @@ sub changePwd {
unless $self->send_mail( $req->data->{mailAddress}, $subject, $body,
$html );
PE_MAILOK;
return PE_MAILOK;
}
sub setSecurity {
......@@ -501,6 +501,7 @@ sub setSecurity {
elsif ( $self->conf->{requireToken} ) {
$self->ott->setToken($req);
}
return 1;
}
sub display {
......@@ -522,7 +523,7 @@ sub display {
MAILALREADYSENT => $req->data->{mailAlreadySent},
MAIL => (
$self->p->checkXSSAttack( 'mail', $req->{user} )
? ""
? ''
: $req->{user}
),
DISPLAY_FORM => 0,
......@@ -532,7 +533,7 @@ sub display {
DISPLAY_PASSWORD_FORM => 0,
);
if ( $req->data->{mailToken}
and !$self->p->checkXSSAttack( 'mail_token', $req->data->{mailToken} ) )
and not $self->p->checkXSSAttack( 'mail_token', $req->data->{mailToken} ) )
{
$tplPrm{MAIL_TOKEN} = $req->data->{mailToken};
}
......@@ -554,7 +555,7 @@ sub display {
or $req->error == PE_CAPTCHAERROR
or $req->error == PE_CAPTCHAEMPTY
)
and !$req->data->{mailToken}
and not $req->data->{mailToken}
)
{
$self->logger->debug('Display form');
......
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