Mathijs den Burger pushed to branch feature/CHANNELMGR-1391 at cms-community / 
hippo-addon-channel-manager


Commits:
a172ae57 by Mathijs den Burger at 2018-03-26T11:10:50+02:00
CHANNELMGR-1391 Read time zone from user session instead of a cookie

The DefaultLoginPlugin puts the selected time zone in the server-side
user session as well as in a cookie. The cookie is used to re-select
a previously selected time zone in the login page, but was now also used
to initialize the time zone in the Channel Manager. That's an unexpected
side channel between modules that should be avoided.

- - - - -


5 changed files:

- frontend-ng/package-lock.json
- frontend-ng/package.json
- frontend-ng/src/app/hippo-cm.js
- frontend-ng/src/app/services/config.service.js
- 
frontend/src/main/java/org/onehippo/cms7/channelmanager/channeleditor/ChannelEditor.java


Changes:

=====================================
frontend-ng/package-lock.json
=====================================
--- a/frontend-ng/package-lock.json
+++ b/frontend-ng/package-lock.json
@@ -371,11 +371,6 @@
       "resolved": 
"https://registry.npmjs.org/angular-aria/-/angular-aria-1.5.11.tgz";,
       "integrity": "sha1-JpY6wzaJHO17GZ5Zr9fpsl5T1qY="
     },
-    "angular-cookies": {
-      "version": "1.5.11",
-      "resolved": 
"https://registry.npmjs.org/angular-cookies/-/angular-cookies-1.5.11.tgz";,
-      "integrity": "sha1-iFWN58UETcw6vreWFNfvgQe6ScA="
-    },
     "angular-local-storage": {
       "version": "0.7.1",
       "resolved": 
"https://registry.npmjs.org/angular-local-storage/-/angular-local-storage-0.7.1.tgz";,


=====================================
frontend-ng/package.json
=====================================
--- a/frontend-ng/package.json
+++ b/frontend-ng/package.json
@@ -28,7 +28,6 @@
     "angular": "1.5.11",
     "angular-animate": "1.5.11",
     "angular-aria": "1.5.11",
-    "angular-cookies": "1.5.11",
     "angular-local-storage": "0.7.1",
     "angular-material": "1.1.5",
     "angular-messages": "1.5.11",


=====================================
frontend-ng/src/app/hippo-cm.js
=====================================
--- a/frontend-ng/src/app/hippo-cm.js
+++ b/frontend-ng/src/app/hippo-cm.js
@@ -16,7 +16,6 @@
 
 import angular from 'angular';
 import ngAnimate from 'angular-animate';
-import ngCookies from 'angular-cookies';
 import ngDeviceDetector from 'ng-device-detector';
 import ngLocalStorage from 'angular-local-storage';
 import ngMaterial from 'angular-material';
@@ -59,7 +58,6 @@ import run from './hippo-cm.run';
 const hippoCmng = angular
   .module('hippo-cm', [
     ngAnimate,
-    ngCookies,
     ngDeviceDetector,
     ngLocalStorage,
     ngMaterial,


=====================================
frontend-ng/src/app/services/config.service.js
=====================================
--- a/frontend-ng/src/app/services/config.service.js
+++ b/frontend-ng/src/app/services/config.service.js
@@ -15,13 +15,12 @@
  */
 
 class ConfigService {
-  constructor($cookies, $window, CmsService) {
+  constructor($window, CmsService) {
     'ngInject';
 
     this.$window = $window;
 
     this.locale = 'en';
-    this.timeZone = $cookies.get('tzcookie');
     this.rootUuid = 'cafebabe-cafe-babe-cafe-babecafebabe';
     this.contextPaths = ['/site'];
 


=====================================
frontend/src/main/java/org/onehippo/cms7/channelmanager/channeleditor/ChannelEditor.java
=====================================
--- 
a/frontend/src/main/java/org/onehippo/cms7/channelmanager/channeleditor/ChannelEditor.java
+++ 
b/frontend/src/main/java/org/onehippo/cms7/channelmanager/channeleditor/ChannelEditor.java
@@ -70,6 +70,10 @@ public class ChannelEditor extends ExtPanel {
 
     @ExtProperty
     @SuppressWarnings("unused")
+    private String timeZone;
+
+    @ExtProperty
+    @SuppressWarnings("unused")
     private String apiUrlPrefix;
 
     @ExtProperty
@@ -122,8 +126,13 @@ public class ChannelEditor extends ExtPanel {
         this.apiUrlPrefix = apiUrlPrefix;
         this.contextPaths = contextPaths;
         this.locale = Session.get().getLocale().toString();
+
+        final UserSession userSession = UserSession.get();
+        this.timeZone = 
userSession.getClientInfo().getProperties().getTimeZone().getID();
+        this.cmsUser = userSession.getJcrSession().getUserID();
+
         this.debug = 
Application.get().getDebugSettings().isAjaxDebugModeEnabled();
-        this.cmsUser = UserSession.get().getJcrSession().getUserID();
+
         this.ckeditorUrl = 
CKEditorConstants.getCKEditorJsReference().getUrl().toString();
         this.ckeditorTimestamp = CKEditorConstants.CKEDITOR_TIMESTAMP;
 



View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-addon-channel-manager/commit/a172ae57c3dcee9a417d755ae59d4193701d4f81

---
View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-addon-channel-manager/commit/a172ae57c3dcee9a417d755ae59d4193701d4f81
You're receiving this email because of your account on code.onehippo.org.
_______________________________________________
Hippocms-svn mailing list
Hippocms-svn@lists.onehippo.org
https://lists.onehippo.org/mailman/listinfo/hippocms-svn

Reply via email to