updates login redirect logic to be more inline with v7, less greedy which is better.

This commit is contained in:
Shannon
2014-02-20 13:37:12 +11:00
parent 545040fdf0
commit a206652a0d
2 changed files with 19 additions and 31 deletions

View File

@@ -100,29 +100,6 @@ namespace Umbraco.Core
return true;
}
/// <summary>
/// Checks if it is a back office login or logout request
/// </summary>
/// <param name="url"></param>
/// <param name="applicationPath"></param>
/// <returns></returns>
internal static bool IsBackOfficeLoginRequest(this Uri url, string applicationPath)
{
applicationPath = applicationPath ?? string.Empty;
var fullUrlPath = url.AbsolutePath.TrimStart(new[] { '/' });
var appPath = applicationPath.TrimStart(new[] { '/' });
var urlPath = fullUrlPath.TrimStart(appPath).EnsureStartsWith('/');
if (urlPath.InvariantStartsWith(GlobalSettings.Path.EnsureStartsWith('/') + "/login.aspx")
|| urlPath.InvariantStartsWith(GlobalSettings.Path.EnsureStartsWith('/') + "/logout.aspx"))
{
return true;
}
return false;
}
/// <summary>
/// Checks if the current uri is an install request
/// </summary>
@@ -139,6 +116,23 @@ namespace Umbraco.Core
return afterAuthority.InvariantStartsWith(IOHelper.ResolveUrl("~/install").TrimStart("/"));
}
/// <summary>
/// Checks if the uri is a request for the default back office page
/// </summary>
/// <param name="url"></param>
/// <returns></returns>
internal static bool IsDefaultBackOfficeRequest(this Uri url)
{
if (url.AbsolutePath.InvariantEquals(GlobalSettings.Path.TrimEnd("/"))
|| url.AbsolutePath.InvariantEquals(GlobalSettings.Path.EnsureEndsWith('/'))
|| url.AbsolutePath.InvariantStartsWith(GlobalSettings.Path.EnsureEndsWith('/') + "Default.aspx")
|| url.AbsolutePath.InvariantStartsWith(GlobalSettings.Path.EnsureEndsWith('/') + "Umbraco.aspx"))
{
return true;
}
return false;
}
/// <summary>
/// This is a performance tweak to check if this is a .css, .js or .ico, .jpg, .jpeg, .png, .gif file request since
/// .Net will pass these requests through to the module when in integrated mode.