diff options
-rw-r--r-- | lib/Travelynx/Controller/Account.pm | 16 | ||||
-rw-r--r-- | templates/_invalid_input.html.ep | 4 |
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/Travelynx/Controller/Account.pm b/lib/Travelynx/Controller/Account.pm index db02dd1..12a059a 100644 --- a/lib/Travelynx/Controller/Account.pm +++ b/lib/Travelynx/Controller/Account.pm @@ -85,6 +85,22 @@ sub register { return; } + 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; + } + } + close($fh); + } + if ( my $error = $self->users->is_name_invalid( name => $user ) ) { $self->render( 'register', invalid => $error ); return; diff --git a/templates/_invalid_input.html.ep b/templates/_invalid_input.html.ep index 4cebf29..6b0fb65 100644 --- a/templates/_invalid_input.html.ep +++ b/templates/_invalid_input.html.ep @@ -78,6 +78,10 @@ <p>Aus Sicherheitsgründen kann der Account nur nach Passworteingabe gelöscht werden.</p> % } + % elsif ($invalid eq 'denylist') { + <span class="card-title">Registrierung deaktiviert</span> + <p>Für diesen Zugang ist derzeit keine Registrierung möglich.</p> + % } % else { <span class="card-title">Fehler</span> <p><%= $invalid %></p> |