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,8 +88,7 @@ sub register {
if ( my $registration_denylist if ( my $registration_denylist
= $self->app->config->{registration}->{denylist} ) = $self->app->config->{registration}->{denylist} )
{ {
open( my $fh, "<", $registration_denylist ) if ( open( my $fh, "<", $registration_denylist ) ) {
or die("cannot open($registration_denylist)");
while ( my $line = <$fh> ) { while ( my $line = <$fh> ) {
chomp $line; chomp $line;
if ( $ip eq $line ) { if ( $ip eq $line ) {
@ -100,6 +99,11 @@ sub register {
} }
close($fh); close($fh);
} }
else {
$self->log->error("Cannot open($registration_denylist): $!");
die("Cannot verify registration: $!");
}
}
if ( my $error = $self->users->is_name_invalid( name => $user ) ) { if ( my $error = $self->users->is_name_invalid( name => $user ) ) {
$self->render( 'register', invalid => $error ); $self->render( 'register', invalid => $error );