Account: do not disclose denylist filename on open error

This commit is contained in:
Daniel Friesel 2021-10-30 10:03:40 +02:00
parent ed0054fa50
commit ac3c70597d
No known key found for this signature in database
GPG key ID: 100D5BFB5166E005

View file

@ -88,17 +88,21 @@ sub register {
if ( my $registration_denylist
= $self->app->config->{registration}->{denylist} )
{
open( my $fh, "<", $registration_denylist )
or die("cannot open($registration_denylist)");
while ( my $line = <$fh> ) {
chomp $line;
if ( $ip eq $line ) {
close($fh);
$self->render( 'register', invalid => "denylist" );
return;
if ( open( my $fh, "<", $registration_denylist ) ) {
while ( my $line = <$fh> ) {
chomp $line;
if ( $ip eq $line ) {
close($fh);
$self->render( 'register', invalid => "denylist" );
return;
}
}
close($fh);
}
else {
$self->log->error("Cannot open($registration_denylist): $!");
die("Cannot verify registration: $!");
}
close($fh);
}
if ( my $error = $self->users->is_name_invalid( name => $user ) ) {