From 2fcae1cc289cfa18e711b335c123b3f0869f983d Mon Sep 17 00:00:00 2001 From: Mole Date: Wed, 24 Feb 2021 12:54:30 +0100 Subject: [PATCH 1/2] Fix installing packages. --- .../ValidateAngularAntiForgeryTokenAttribute.cs | 9 --------- .../packages/views/install-local.controller.js | 14 +++++++++++--- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/Umbraco.Web.BackOffice/Filters/ValidateAngularAntiForgeryTokenAttribute.cs b/src/Umbraco.Web.BackOffice/Filters/ValidateAngularAntiForgeryTokenAttribute.cs index 8e3c6d97ca..f45744b16d 100644 --- a/src/Umbraco.Web.BackOffice/Filters/ValidateAngularAntiForgeryTokenAttribute.cs +++ b/src/Umbraco.Web.BackOffice/Filters/ValidateAngularAntiForgeryTokenAttribute.cs @@ -44,15 +44,6 @@ namespace Umbraco.Cms.Web.BackOffice.Filters public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) { - if (context.Controller is ControllerBase controller && controller.User.Identity is ClaimsIdentity userIdentity) - { - // if there is not CookiePath claim, then exit - if (userIdentity.HasClaim(x => x.Type == ClaimTypes.CookiePath) == false) - { - await next(); - } - } - var cookieToken = _cookieManager.GetCookieValue(Constants.Web.CsrfValidationCookieName); var httpContext = context.HttpContext; diff --git a/src/Umbraco.Web.UI.Client/src/views/packages/views/install-local.controller.js b/src/Umbraco.Web.UI.Client/src/views/packages/views/install-local.controller.js index 0d9341243b..5d3869283e 100644 --- a/src/Umbraco.Web.UI.Client/src/views/packages/views/install-local.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/packages/views/install-local.controller.js @@ -146,13 +146,14 @@ //check if the app domain is restarted ever 2 seconds var count = 0; + var maxCount = 5; function checkRestart() { $timeout(function () { packageResource.checkRestart(pack).then(function (d) { count++; //if there is an id it means it's not restarted yet but we'll limit it to only check 10 times - if (d.isRestarting && count < 10) { + if (d.isRestarting && count < maxCount) { checkRestart(); } else { @@ -160,9 +161,16 @@ deferred.resolve(d); } }, - installError); + function(){ + if(count >= maxCount){ + installError(); + } + else { + checkRestart(); + } + }); }, - 2000); + 2000*(count+1)); } checkRestart(); From 0a2efc252fbd90653ea22ca58206d801b4c050e2 Mon Sep 17 00:00:00 2001 From: Mole Date: Wed, 24 Feb 2021 13:20:53 +0100 Subject: [PATCH 2/2] Re introduce cookie check, but adding return statement --- .../ValidateAngularAntiForgeryTokenAttribute.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Umbraco.Web.BackOffice/Filters/ValidateAngularAntiForgeryTokenAttribute.cs b/src/Umbraco.Web.BackOffice/Filters/ValidateAngularAntiForgeryTokenAttribute.cs index f45744b16d..c4290396b6 100644 --- a/src/Umbraco.Web.BackOffice/Filters/ValidateAngularAntiForgeryTokenAttribute.cs +++ b/src/Umbraco.Web.BackOffice/Filters/ValidateAngularAntiForgeryTokenAttribute.cs @@ -44,6 +44,16 @@ namespace Umbraco.Cms.Web.BackOffice.Filters public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) { + if (context.Controller is ControllerBase controller && controller.User.Identity is ClaimsIdentity userIdentity) + { + // if there is not CookiePath claim, then exit + if (userIdentity.HasClaim(x => x.Type == ClaimTypes.CookiePath) == false) + { + await next(); + return; + } + } + var cookieToken = _cookieManager.GetCookieValue(Constants.Web.CsrfValidationCookieName); var httpContext = context.HttpContext;