summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Controller/Account.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-08-20 22:52:02 +0200
committerDaniel Friesel <derf@finalrewind.org>2021-08-20 22:52:02 +0200
commit39ab6e57d391fd9e6b6cd7b8e81b4140d8864a37 (patch)
tree37a993246e7edb8ed9c21f1436f0d39604082aa9 /lib/Travelynx/Controller/Account.pm
parent64e20b50cf3547bf0fa0bbd6823532142bd11763 (diff)
allow registration to be denied for certain IPs, e.g. known spammers
(yes, there are actually spambots flooding people with unsolicited registration e-mails)
Diffstat (limited to 'lib/Travelynx/Controller/Account.pm')
-rw-r--r--lib/Travelynx/Controller/Account.pm16
1 files changed, 16 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;