mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 14:34:23 +01:00
App domain redirect (#4391)
* Fix duplicates in GetAllApps with allowNoUser * Use domain mapping as canonical reference and redirect to it * Revert domain mapping to hostname instead of URL
This commit is contained in:
@@ -758,22 +758,21 @@ namespace BTCPayServer.Controllers
|
||||
{
|
||||
return Redirect(returnUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
// After login, if there is an app on "/", we should redirect to BTCPay explicit home route, and not to the app.
|
||||
if (PoliciesSettings.RootAppId is not null && PoliciesSettings.RootAppType is not null)
|
||||
return RedirectToAction(nameof(UIHomeController.Home), "UIHome");
|
||||
if (PoliciesSettings.DomainToAppMapping is { } mapping)
|
||||
{
|
||||
var matchedDomainMapping = mapping.FirstOrDefault(item =>
|
||||
item.Domain.Equals(this.HttpContext.Request.Host.Host, StringComparison.InvariantCultureIgnoreCase));
|
||||
if (matchedDomainMapping is not null)
|
||||
return RedirectToAction(nameof(UIHomeController.Home), "UIHome");
|
||||
}
|
||||
return RedirectToAction(nameof(UIHomeController.Index), "UIHome");
|
||||
}
|
||||
}
|
||||
|
||||
// After login, if there is an app on "/", we should redirect to BTCPay explicit home route, and not to the app.
|
||||
if (PoliciesSettings.RootAppId is not null && PoliciesSettings.RootAppType is not null)
|
||||
return RedirectToAction(nameof(UIHomeController.Home), "UIHome");
|
||||
|
||||
if (PoliciesSettings.DomainToAppMapping is { } mapping)
|
||||
{
|
||||
var matchedDomainMapping = mapping.FirstOrDefault(item =>
|
||||
item.Domain.Equals(HttpContext.Request.Host.Host, StringComparison.InvariantCultureIgnoreCase));
|
||||
if (matchedDomainMapping is not null)
|
||||
return RedirectToAction(nameof(UIHomeController.Home), "UIHome");
|
||||
}
|
||||
|
||||
return RedirectToAction(nameof(UIHomeController.Index), "UIHome");
|
||||
}
|
||||
|
||||
private bool CanLoginOrRegister()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user