Initial flash error implementation
This commit is contained in:
parent
052fb6f6a1
commit
2845fd7499
|
@ -50,7 +50,5 @@ Add the `-v` option for more verbose output
|
|||
## TODOs
|
||||
|
||||
1. Input validation
|
||||
1. Add homepage/URL field and filter URLs out of message body
|
||||
1. Flash error for CAPTCHA failures and what nots
|
||||
1. Replace HTML tables with CSS grids(!!)
|
||||
1. Filter URLs out of message body
|
||||
1. Add column to tag posts as spam or hidden
|
||||
|
|
|
@ -101,7 +101,6 @@ article {
|
|||
|
||||
article .message.field {
|
||||
font-family: cursive;
|
||||
/* font-size: 1.35em; */
|
||||
margin-bottom: 0em;
|
||||
}
|
||||
|
||||
|
@ -124,18 +123,28 @@ nav {
|
|||
flex-flow: row wrap;
|
||||
justify-content: center;
|
||||
gap: 1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
h1#top {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.error {
|
||||
border-style: solid;
|
||||
border-color: red;
|
||||
color: red;
|
||||
padding: 1em;
|
||||
text-align: center;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1023px) {
|
||||
.inner {
|
||||
max-width: 90%;
|
||||
max-width: 95%;
|
||||
}
|
||||
|
||||
.outer {
|
||||
max-width: 95%;
|
||||
max-width: 99%;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,8 @@ under sub ($c) {
|
|||
# https://paramdeo.com/blog/opting-your-website-out-of-googles-floc-network
|
||||
$c->res->headers->header('Permissions-Policy', 'interest-cohort=()');
|
||||
|
||||
$c->session();
|
||||
|
||||
1;
|
||||
};
|
||||
|
||||
|
@ -61,14 +63,20 @@ get '/' => sub ($c) {
|
|||
} => 'index';
|
||||
|
||||
any [qw{GET POST}], '/sign' => sub ($c) {
|
||||
if ($c->req->method() eq 'POST' && $c->param('message')) {
|
||||
if ($c->req->method() eq 'POST') {
|
||||
my $name = $c->param('name') || 'Anonymous';
|
||||
my $url = $c->param('url');
|
||||
my $message = $c->param('message');
|
||||
my $answer = $c->param('answer');
|
||||
|
||||
$c->message->create_post($name, $message, $url) if $answer;
|
||||
$c->redirect_to('index');
|
||||
if ($message && $answer) {
|
||||
$c->message->create_post($name, $message, $url);
|
||||
$c->redirect_to('index');
|
||||
}
|
||||
else {
|
||||
$c->flash(error => 'Uh-oh!! Please try again.');
|
||||
$c->redirect_to('sign');
|
||||
}
|
||||
}
|
||||
else {
|
||||
# Try to randomize things for the CAPTCHA challenge. The
|
||||
|
|
|
@ -8,11 +8,17 @@
|
|||
<body>
|
||||
<div class="outer">
|
||||
<h1 id="top">Guestbook-NG</h1>
|
||||
<!-- Nav table -->
|
||||
<nav>
|
||||
<%= link_to View => 'index' %>
|
||||
<%= link_to Sign => 'sign' %>
|
||||
</nav>
|
||||
<% if (flash 'error') { =%>
|
||||
<div class="error">
|
||||
<h2>Stop! You've violated the law:</h2>
|
||||
<p><%= flash 'error' %></p>
|
||||
<p>This incident has been reported to the cyber-police.</p>
|
||||
</div>
|
||||
<% } =%>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="inner">
|
||||
|
|
Loading…
Reference in New Issue
Block a user