Skip to content

Commit

Permalink
Fixed: Redirecting after login
Browse files Browse the repository at this point in the history
(cherry picked from commit 745b92daf4bf4b9562ffe52dad84a12a5561add5)
  • Loading branch information
markus101 authored and mynameisbogdan committed Feb 7, 2024
1 parent 1536e90 commit 0871949
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Lidarr.Http/Authentication/AuthenticationController.cs
Expand Up @@ -4,6 +4,7 @@
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Authentication;
using NzbDrone.Core.Configuration;

Expand Down Expand Up @@ -46,7 +47,17 @@ public async Task<IActionResult> Login([FromForm] LoginResource resource, [FromQ

await HttpContext.SignInAsync(AuthenticationType.Forms.ToString(), new ClaimsPrincipal(new ClaimsIdentity(claims, "Cookies", "user", "identifier")), authProperties);

return Redirect(_configFileProvider.UrlBase + "/");
if (returnUrl.IsNullOrWhiteSpace())
{
return Redirect(_configFileProvider.UrlBase + "/");
}

if (_configFileProvider.UrlBase.IsNullOrWhiteSpace() || returnUrl.StartsWith(_configFileProvider.UrlBase))
{
return Redirect(returnUrl);
}

return Redirect(_configFileProvider.UrlBase + returnUrl);
}

[HttpGet("logout")]
Expand Down

0 comments on commit 0871949

Please sign in to comment.