From 939cac264adda2447c3a747c9d4474554ff2f7bd Mon Sep 17 00:00:00 2001 From: Warren Date: Tue, 12 Jun 2018 12:38:32 +0100 Subject: [PATCH] Get the x-umb-user-modified header to work - set a new profile photo or remove it and ensure header is sent down & the event is emitted to update the avatar --- .../src/common/security/securityinterceptor.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/security/securityinterceptor.js b/src/Umbraco.Web.UI.Client/src/common/security/securityinterceptor.js index c36ae48a8d..68e19d221c 100644 --- a/src/Umbraco.Web.UI.Client/src/common/security/securityinterceptor.js +++ b/src/Umbraco.Web.UI.Client/src/common/security/securityinterceptor.js @@ -18,28 +18,27 @@ angular.module('umbraco.security.interceptor') }, 'response': function(response) { - // do something on success - console.log('response success', response); - var headers = response.headers(); - console.log('response success headers', headers); - - /* // Intercept successful requests //Here we'll check if our custom header is in the response which indicates how many seconds the user's session has before it //expires. Then we'll update the user in the user service accordingly. - var headers = originalResponse.headers(); + var headers = response.headers(); + + //WB: Logging to help temp-debugging + console.log('response success', response); + console.log('response success headers', headers); + + if (headers["x-umb-user-seconds"]) { // We must use $injector to get the $http service to prevent circular dependency var userService = $injector.get('userService'); userService.setUserTimeout(headers["x-umb-user-seconds"]); } - + //this checks if the user's values have changed, in which case we need to update the user details throughout //the back office similar to how we do when a user logs in if (headers["x-umb-user-modified"]) { eventsService.emit("app.userRefresh"); } - */ return response; },