瀏覽代碼

feat(profile): Don't allow non-guest users to edit their profile

j8
hristoterezov 8 年之前
父節點
當前提交
f10b13328f
共有 3 個檔案被更改,包括 10 行新增2 行删除
  1. 5
    1
      config.js
  2. 3
    0
      modules/TokenData/TokenData.js
  3. 2
    1
      modules/UI/UI.js

+ 5
- 1
config.js 查看文件

@@ -69,5 +69,9 @@ var config = {
69 69
     'During that time service will not be available. ' +
70 70
     'Apologise for inconvenience.',*/
71 71
     disableThirdPartyRequests: false,
72
-    minHDHeight: 540
72
+    minHDHeight: 540,
73
+    // If true - all users without token will be considered guests and all users
74
+    // with token will be considered non-guests. Only guests will be allowed to
75
+    // edit their profile.
76
+    enableUserRolesBasedOnToken: false
73 77
 };

+ 3
- 0
modules/TokenData/TokenData.js 查看文件

@@ -65,9 +65,12 @@ class TokenData{
65 65
      * @param {string} the JWT token
66 66
      */
67 67
     constructor(jwt) {
68
+        this.isGuest = true;
68 69
         if(!jwt)
69 70
             return;
70 71
 
72
+        this.isGuest = config.enableUserRolesBasedOnToken !== true;
73
+
71 74
         this.jwt = jwt;
72 75
 
73 76
         //External API settings

+ 2
- 1
modules/UI/UI.js 查看文件

@@ -367,7 +367,8 @@ function registerListeners() {
367 367
     UI.addListener(UIEvents.TOGGLE_CONTACT_LIST, UI.toggleContactList);
368 368
 
369 369
     UI.addListener( UIEvents.TOGGLE_PROFILE, function() {
370
-        UI.toggleSidePanel("profile_container");
370
+        if(APP.tokenData.isGuest)
371
+            UI.toggleSidePanel("profile_container");
371 372
     });
372 373
 
373 374
     UI.addListener(UIEvents.TOGGLE_FILM_STRIP, UI.handleToggleFilmStrip);

Loading…
取消
儲存