Merge branch 'v7/dev' into v8/dev

# Conflicts:
#	src/Umbraco.Core/Persistence/Repositories/MediaRepository.cs
#	src/Umbraco.Core/Persistence/Repositories/VersionableRepositoryBase.cs
#	src/Umbraco.Web.UI.Client/src/common/security/securityinterceptor.js
This commit is contained in:
Sebastiaan Janssen
2019-04-23 20:36:48 +02:00

View File

@@ -59,20 +59,27 @@
}
//A 401 means that the user is not logged in
if (rejection.status === 401 && !rejection.config.url.endsWith("umbraco/backoffice/UmbracoApi/Authentication/GetCurrentUser")) {
if (rejection.status === 401) {
//avoid an infinite loop
var umbRequestHelper = $injector.get('umbRequestHelper');
var getCurrentUserPath = umbRequestHelper.getApiUrl("authenticationApiBaseUrl", "GetCurrentUser");
if (!rejection.config.url.endsWith(getCurrentUserPath)) {
var userService = $injector.get('userService'); // see above
var userService = $injector.get('userService'); // see above
//Associate the user name with the retry to ensure we retry for the right user
return userService.getCurrentUser()
.then(function (user) {
var userName = user ? user.name : null;
//The request bounced because it was not authorized - add a new request to the retry queue
return requestRetryQueue.pushRetryFn('unauthorized-server', userName, function retryRequest() {
// We must use $injector to get the $http service to prevent circular dependency
return $injector.get('$http')(rejection.config);
//Associate the user name with the retry to ensure we retry for the right user
return userService.getCurrentUser()
.then(function(user) {
var userName = user ? user.name : null;
//The request bounced because it was not authorized - add a new request to the retry queue
return requestRetryQueue.pushRetryFn('unauthorized-server',
userName,
function retryRequest() {
// We must use $injector to get the $http service to prevent circular dependency
return $injector.get('$http')(rejection.config);
});
});
});
}
}
else if (rejection.status === 404) {