diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 097cb3ac877b..b26e1cf6b857 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -194,8 +194,8 @@ class LoginController extends BaseController } $user->setCompany($user->account->default_company); - $timeout = auth()->user()->company()->default_password_timeout / 60000; - Cache::put(auth()->user()->hashed_id.'_logged_in', Str::random(64), $timeout); + $timeout = $user->company()->default_password_timeout / 60000; + Cache::put($user->hashed_id.'_logged_in', Str::random(64), $timeout); $cu = CompanyUser::query() ->where('user_id', auth()->user()->id); diff --git a/app/Http/Middleware/PasswordProtection.php b/app/Http/Middleware/PasswordProtection.php index f4f7f0660bae..ffb3ec19a029 100644 --- a/app/Http/Middleware/PasswordProtection.php +++ b/app/Http/Middleware/PasswordProtection.php @@ -46,8 +46,7 @@ class PasswordProtection if (Cache::get(auth()->user()->hashed_id.'_logged_in')) { - Cache::pull(auth()->user()->hashed_id.'_logged_in'); - Cache::add(auth()->user()->hashed_id.'_logged_in', Str::random(64), $timeout); + Cache::put(auth()->user()->hashed_id.'_logged_in', Str::random(64), $timeout); return $next($request);