feat: redirect to referer on logout if possible

This commit is contained in:
Oliver Booth 2024-02-25 14:19:26 +00:00
parent 6db3aba1c2
commit c5a4ac37b2
Signed by: oliverbooth
GPG Key ID: E60B570D1B7557B5

View File

@ -72,6 +72,13 @@ public sealed class AdminController : ControllerBase
_sessionService.DeleteSession(session); _sessionService.DeleteSession(session);
} }
return _sessionService.DeleteSessionCookie(Response); _sessionService.DeleteSessionCookie(Response);
if (Request.Headers.Referer is var referer && !string.IsNullOrWhiteSpace(referer.ToString()))
{
return Redirect(referer!);
}
return RedirectToPage("/admin/login");
} }
} }