From 11ad2cd57eae0e9050bafeb7754fabcfe3e8d4cb Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 4 Mar 2021 12:17:29 +1100 Subject: [PATCH] Fixes for caching protection route --- app/Http/Middleware/PasswordProtection.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Http/Middleware/PasswordProtection.php b/app/Http/Middleware/PasswordProtection.php index 16bb85d992..20535de73d 100644 --- a/app/Http/Middleware/PasswordProtection.php +++ b/app/Http/Middleware/PasswordProtection.php @@ -53,7 +53,7 @@ class PasswordProtection /* Cannot allow duplicates! */ if ($existing_user = MultiDB::hasUser($query)) { - Cache::add(auth()->user()->email.'_logged_in', Str::random(64), now()->addMinutes(30)); + Cache::add(auth()->user()->hashed_id.'_logged_in', Str::random(64), now()->addMinutes(30)); return $next($request); } } @@ -74,10 +74,10 @@ class PasswordProtection return response()->json($error, 403); } - } elseif (Cache::get(auth()->user()->email.'_logged_in')) { + } elseif (Cache::get(auth()->user()->hashed_id.'_logged_in')) { - Cache::pull(auth()->user()->email.'_logged_in'); - Cache::add(auth()->user()->email.'_logged_in', Str::random(64), now()->addMinutes(30)); + Cache::pull(auth()->user()->hashed_id.'_logged_in'); + Cache::add(auth()->user()->hashed_id.'_logged_in', Str::random(64), now()->addMinutes(30)); return $next($request);