1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 06:32:40 +01:00

Fixes for caching protection route

This commit is contained in:
David Bomba 2021-03-04 12:17:29 +11:00
parent 07aca3d8c0
commit 11ad2cd57e

View File

@ -53,7 +53,7 @@ class PasswordProtection
/* Cannot allow duplicates! */ /* Cannot allow duplicates! */
if ($existing_user = MultiDB::hasUser($query)) { 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); return $next($request);
} }
} }
@ -74,10 +74,10 @@ class PasswordProtection
return response()->json($error, 403); 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::pull(auth()->user()->hashed_id.'_logged_in');
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); return $next($request);