Browse Source

Added a token test on the cookie reading

Roland Haroutiounian 8 years ago
parent
commit
cb37a065c4
1 changed files with 8 additions and 0 deletions
  1. 8
    0
      plugins/webui/run.py

+ 8
- 0
plugins/webui/run.py View File

@@ -26,12 +26,20 @@ from werkzeug.contrib.securecookie import SecureCookie
26 26
 
27 27
 def load_cookie(request):
28 28
     datas = request.cookies.get(COOKIE_SESSION_ID)
29
+
29 30
     if not datas:
30 31
         return None
32
+
31 33
     cookie_content = SecureCookie.unserialize(datas, COOKIE_SECRET_KEY)
34
+
35
+    if 'token' not in cookie_content:
36
+        return None
37
+
32 38
     token = cookie_content['token']
39
+
33 40
     if token is None or len(token) == 0:
34 41
         return None
42
+
35 43
     return token
36 44
 
37 45
 

Loading…
Cancel
Save