diff options
author | Daniel Friesel <derf@finalrewind.org> | 2021-10-30 10:03:40 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2021-10-30 10:03:40 +0200 |
commit | ac3c70597dfc8f19627f2e9ad109e741021690a0 (patch) | |
tree | 4befc51309578a201e876f65b3ab9fc635ee9e6d /lib/Travelynx/Controller | |
parent | ed0054fa50da9e4a3e08ef069b8b5bbc9709934f (diff) |
Account: do not disclose denylist filename on open error
Diffstat (limited to 'lib/Travelynx/Controller')
-rw-r--r-- | lib/Travelynx/Controller/Account.pm | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/Travelynx/Controller/Account.pm b/lib/Travelynx/Controller/Account.pm index 12a059a..312cc9e 100644 --- a/lib/Travelynx/Controller/Account.pm +++ b/lib/Travelynx/Controller/Account.pm @@ -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 ) ) { |