diff --git a/guestbook-ng.pl b/guestbook-ng.pl index 38a8f6a..8a1db90 100755 --- a/guestbook-ng.pl +++ b/guestbook-ng.pl @@ -68,14 +68,15 @@ any [qw{GET POST}], '/sign' => sub ($c) { my $name = $c->param('name') || 'Anonymous'; my $url = $c->param('url'); my $message = $c->param('message'); - my $spam = $c->param('answer') ? 0 : 1; - - # No URLs in message body since they have their own field - $spam = - $message =~ /$RE{URI}{HTTP}{-scheme => qr}/ ? 1 : 0; + my $spam = + !$c->param('answer') ? 1 : + $message =~ /$RE{URI}{HTTP}{-scheme => qr}/ ? 1 : + 0; if ($message) { $c->message->create_post($name, $message, $url, $spam); + + $c->flash(error => 'This message was flagged as spam') if $spam; $c->redirect_to('index'); } else { diff --git a/templates/layouts/default.html.ep b/templates/layouts/default.html.ep index 9e5dbd1..51d0bde 100644 --- a/templates/layouts/default.html.ep +++ b/templates/layouts/default.html.ep @@ -16,7 +16,8 @@

Stop! You've violated the law:

<%= flash 'error' %>

-

This incident has been reported to the cyber-police.

+

Please report to the + <%= link_to 'cyber police', 'mailto:swaggboi@slackware.uk' %>!

<% } =%>