1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 08:51:34 +02: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! */
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);