From 187b099ab053c3cb8d3e2289db50ea30bfebfd45 Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+studip@gmail.com>
Date: Fri, 3 Jan 2025 11:30:44 +0000
Subject: [PATCH] next attempt to redirect to personal start page by unsetting
 redirect page on start page, fixes #5030

Closes #5030

Merge request studip/studip!3793
---
 lib/middleware/AuthenticationMiddleware.php | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/middleware/AuthenticationMiddleware.php b/lib/middleware/AuthenticationMiddleware.php
index f86b06730f0..10de00401bd 100644
--- a/lib/middleware/AuthenticationMiddleware.php
+++ b/lib/middleware/AuthenticationMiddleware.php
@@ -34,6 +34,8 @@ final class AuthenticationMiddleware implements MiddlewareInterface
         } else {
             if (!match_route('dispatch.php/start')) {
                 $_SESSION['redirect_after_login'] = \Request::url();
+            } else {
+                unset($_SESSION['redirect_after_login']);
             }
             $response = $this->response_factory->createResponse(302);
             return $response->withHeader('Location', \URLHelper::getURL('dispatch.php/login'));
-- 
GitLab