Switched to session storage

This commit is contained in:
Julian Prieber 2023-07-14 13:45:42 +02:00
parent 2a47554428
commit b99a975de1
2 changed files with 6 additions and 5 deletions

View File

@ -680,7 +680,7 @@ public function SendTestMail(Request $request)
$user->remember_token = null; $user->remember_token = null;
$user->save(); $user->save();
setcookie("display_auth_nav", "", time() - 3600, "/"); $request->session()->forget('display_auth_nav');
Auth::loginUsingId($userID); Auth::loginUsingId($userID);

View File

@ -35,10 +35,11 @@ class Impersonate
} }
Auth::loginUsingId($id); Auth::loginUsingId($id);
setcookie("display_auth_nav", "true", time() + (10 * 365 * 24 * 60 * 60), "/"); $request->session()->put('display_auth_nav', true);
$request->session()->save();
} }
if(isset($_COOKIE['display_auth_nav'])) { if($request->session()->has('display_auth_nav')) {
if (file_exists(base_path(findAvatar($id)))) { if (file_exists(base_path(findAvatar($id)))) {
$img = '<img alt="avatar" class="iimg irounded" src="' . url(findAvatar($id)) . '">'; $img = '<img alt="avatar" class="iimg irounded" src="' . url(findAvatar($id)) . '">';
} elseif (file_exists(base_path("assets/linkstack/images/").findFile('avatar'))) { } elseif (file_exists(base_path("assets/linkstack/images/").findFile('avatar'))) {
@ -148,8 +149,8 @@ EOD;;
return $response; return $response;
} else { } else {
if(isset($_COOKIE['display_auth_nav'])) { if($request->session()->has('display_auth_nav')) {
setcookie("display_auth_nav", "", time() - 3600, "/"); $request->session()->forget('display_auth_nav');
Auth::logout(); Auth::logout();
} }
return $next($request); return $next($request);