From b9f2604bb5baacd3a2daef886acee6fba6029fd7 Mon Sep 17 00:00:00 2001 From: Frankie B Date: Sun, 16 Jul 2023 15:30:11 +0100 Subject: Update error message files, increment version --- app/Http/Controllers/GuestbookController.php | 2 +- app/Http/Middleware/RateLimiter.php | 2 +- config/app.php | 2 +- resources/views/errors/guestbook-ban.blade.php | 12 ------------ resources/views/errors/guestbook-ipban.blade.php | 12 ++++++++++++ resources/views/errors/guestbook-ratelimit.blade.php | 10 ++++++++++ resources/views/errors/ratelimit-guestbook.blade.php | 10 ---------- 7 files changed, 25 insertions(+), 25 deletions(-) delete mode 100644 resources/views/errors/guestbook-ban.blade.php create mode 100644 resources/views/errors/guestbook-ipban.blade.php create mode 100644 resources/views/errors/guestbook-ratelimit.blade.php delete mode 100644 resources/views/errors/ratelimit-guestbook.blade.php diff --git a/app/Http/Controllers/GuestbookController.php b/app/Http/Controllers/GuestbookController.php index da5391d..12b1c7f 100644 --- a/app/Http/Controllers/GuestbookController.php +++ b/app/Http/Controllers/GuestbookController.php @@ -19,7 +19,7 @@ class GuestbookController extends Controller { $matching_bans = DB::select('SELECT reason FROM guestbook_bans WHERE ip_address = ?', array($request->ip())); if (count($matching_bans) > 0 ) { - return view('errors.guestbook-ban')->with('reason', $matching_bans[0]->reason); + return view('errors.guestbook-ipban')->with('reason', $matching_bans[0]->reason); } DB::insert('INSERT INTO guestbook_entries (name, timestamp, ip_address, agent, message) values (?, ?, ?, ?, ?)', array( diff --git a/app/Http/Middleware/RateLimiter.php b/app/Http/Middleware/RateLimiter.php index c81da43..3ca9268 100644 --- a/app/Http/Middleware/RateLimiter.php +++ b/app/Http/Middleware/RateLimiter.php @@ -21,7 +21,7 @@ class RateLimiter if (Cache::has($cacheKey)) { // If the cache key exists, the IP has submitted an entry within the last hour - return response()->view('errors.ratelimit-guestbook', [], 429); + return response()->view('errors.guestbook-ratelimit', [], 429); } // Add the IP address to the cache and set the expiration time to one hour diff --git a/config/app.php b/config/app.php index e7a6305..275fd7c 100644 --- a/config/app.php +++ b/config/app.php @@ -17,7 +17,7 @@ return [ */ 'name' => env('APP_NAME', 'diskfloppy.me'), - 'version' => '5.4.4', + 'version' => '5.4.5', /* |-------------------------------------------------------------------------- diff --git a/resources/views/errors/guestbook-ban.blade.php b/resources/views/errors/guestbook-ban.blade.php deleted file mode 100644 index 257dd72..0000000 --- a/resources/views/errors/guestbook-ban.blade.php +++ /dev/null @@ -1,12 +0,0 @@ -@extends('layouts.minimal') -@section('title', 'Error 403: IP Blocked!') -@section('content') -

Error 403: IP Blocked!

-
-

Your IP has been banned from submitting to the guestbook.

- @if (isset($reason)) -

Reason: {{ $reason }}

- @endif -
- Click here to go back to the guestbook. -@stop diff --git a/resources/views/errors/guestbook-ipban.blade.php b/resources/views/errors/guestbook-ipban.blade.php new file mode 100644 index 0000000..257dd72 --- /dev/null +++ b/resources/views/errors/guestbook-ipban.blade.php @@ -0,0 +1,12 @@ +@extends('layouts.minimal') +@section('title', 'Error 403: IP Blocked!') +@section('content') +

Error 403: IP Blocked!

+
+

Your IP has been banned from submitting to the guestbook.

+ @if (isset($reason)) +

Reason: {{ $reason }}

+ @endif +
+ Click here to go back to the guestbook. +@stop diff --git a/resources/views/errors/guestbook-ratelimit.blade.php b/resources/views/errors/guestbook-ratelimit.blade.php new file mode 100644 index 0000000..1890789 --- /dev/null +++ b/resources/views/errors/guestbook-ratelimit.blade.php @@ -0,0 +1,10 @@ +@extends('layouts.minimal') +@section('title', 'Error 429: Overclocking Detected!') +@section('content') +

Error 429: Overclocking Detected!

+
+

Whoa there! Your submissions are going at warp speed.

+

Remember you can only submit an entry once every hour!

+
+ Click here to go back to the guestbook. +@stop diff --git a/resources/views/errors/ratelimit-guestbook.blade.php b/resources/views/errors/ratelimit-guestbook.blade.php deleted file mode 100644 index 1890789..0000000 --- a/resources/views/errors/ratelimit-guestbook.blade.php +++ /dev/null @@ -1,10 +0,0 @@ -@extends('layouts.minimal') -@section('title', 'Error 429: Overclocking Detected!') -@section('content') -

Error 429: Overclocking Detected!

-
-

Whoa there! Your submissions are going at warp speed.

-

Remember you can only submit an entry once every hour!

-
- Click here to go back to the guestbook. -@stop -- cgit v1.2.3-54-g00ecf